summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2018-02-16 11:11:11 +0000
committerPatrick Steinhardt <ps@pks.im>2018-02-16 11:41:17 +0000
commit7c6e91759facc76e3f99373b759b4506fd700608 (patch)
tree6acd70558f0d40213df9b43252e9aaceee54e69d
parent522f3e4b4bedf9e4226f5e16498934b26d80dfbc (diff)
downloadlibgit2-7c6e91759facc76e3f99373b759b4506fd700608.tar.gz
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.
-rw-r--r--src/index.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/index.c b/src/index.c
index b7602fb44..d782a0803 100644
--- a/src/index.c
+++ b/src/index.c
@@ -2494,7 +2494,7 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
/* Parse all the entries */
for (i = 0; i < header.entry_count && buffer_size > INDEX_FOOTER_SIZE; ++i) {
- git_index_entry *entry;
+ git_index_entry *entry = NULL;
size_t entry_size = read_entry(&entry, index, buffer, buffer_size, last);
/* 0 bytes read means an object corruption */