Skip to content

Commit 7c6e917

Browse files
committed
index: shut up warning on uninitialized variable
Even though the `entry` variable will always be initialized when `read_entry` returns success and even though we never dereference `entry` in case `read_entry` fails, GCC prints a warning about uninitialized use. Just initialize the pointer to `NULL` in order to shut GCC up.
1 parent 522f3e4 commit 7c6e917

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2494,7 +2494,7 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
24942494

24952495
/* Parse all the entries */
24962496
for (i = 0; i < header.entry_count && buffer_size > INDEX_FOOTER_SIZE; ++i) {
2497-
git_index_entry *entry;
2497+
git_index_entry *entry = NULL;
24982498
size_t entry_size = read_entry(&entry, index, buffer, buffer_size, last);
24992499

25002500
/* 0 bytes read means an object corruption */

0 commit comments

Comments
 (0)