Skip to content

Commit 1c35a3b

Browse files
committed
load_revindex_from_disk(): avoid accessing uninitialized data
The `revindex_size` value is uninitialized in case the function is erroring out, but we want to assign its value. Let's just initialize it. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent a43bde2 commit 1c35a3b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pack-revindex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ static int load_revindex_from_disk(const struct git_hash_algo *algo,
211211
int fd, ret = 0;
212212
struct stat st;
213213
void *data = NULL;
214-
size_t revindex_size;
214+
size_t revindex_size = 0;
215215
struct revindex_header *hdr;
216216

217217
if (git_env_bool(GIT_TEST_REV_INDEX_DIE_ON_DISK, 0))

0 commit comments

Comments
 (0)