Skip to content

Commit fe44a97

Browse files
committed
Merge branch 'uninitialized-variables'
A few places where CodeQL thinks that variables might be uninitialized. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents e92866b + da875fb commit fe44a97

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

builtin/cat-file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
106106
struct object_id oid;
107107
enum object_type type;
108108
char *buf;
109-
unsigned long size;
109+
unsigned long size = 0;
110110
struct object_context obj_context = {0};
111111
struct object_info oi = OBJECT_INFO_INIT;
112112
unsigned flags = OBJECT_INFO_LOOKUP_REPLACE;

fsck.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ static int fsck_commit(const struct object_id *oid,
926926
{
927927
struct object_id tree_oid, parent_oid;
928928
unsigned author_count;
929-
int err;
929+
int err = 0;
930930
const char *buffer_begin = buffer;
931931
const char *buffer_end = buffer + size;
932932
const char *p;

pack-mtimes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static int load_pack_mtimes_file(char *mtimes_file,
2828
int fd, ret = 0;
2929
struct stat st;
3030
uint32_t *data = NULL;
31-
size_t mtimes_size, expected_size;
31+
size_t mtimes_size = 0, expected_size;
3232
struct mtimes_header header;
3333

3434
fd = git_open(mtimes_file);

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)