Skip to content

Commit 04f6ee1

Browse files
telezhnayagitster
authored andcommitted
ref-filter: initialize eaten variable
Initialize variable `eaten` before its using. We may initialize it in parse_object_buffer(), but there are cases when we do not reach this invocation. Signed-off-by: Olga Telezhnaia <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 20a9c15 commit 04f6ee1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ref-filter.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,8 @@ static const char *get_refname(struct used_atom *atom, struct ref_array_item *re
14391439
static int get_object(struct ref_array_item *ref, const struct object_id *oid,
14401440
int deref, struct object **obj, struct strbuf *err)
14411441
{
1442-
int eaten;
1442+
/* parse_object_buffer() will set eaten to 0 if free() will be needed */
1443+
int eaten = 1;
14431444
int ret = 0;
14441445
unsigned long size;
14451446
void *buf = get_obj(oid, obj, &size, &eaten);

0 commit comments

Comments
 (0)