ref-filter: initialize eaten variable
authorOlga Telezhnaya <olyatelezhnaya@gmail.com>
Tue, 17 Jul 2018 08:22:57 +0000 (08:22 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 17 Jul 2018 22:04:29 +0000 (15:04 -0700)
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 <olyatelezhnaya@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ref-filter.c
index 27733ef013bed8dc2affa706b3389841cd16fe23..8db7ca95b12c09bb780b214aa6ca58722a26a007 100644 (file)
@@ -1439,7 +1439,8 @@ static const char *get_refname(struct used_atom *atom, struct ref_array_item *re
 static int get_object(struct ref_array_item *ref, const struct object_id *oid,
                       int deref, struct object **obj, struct strbuf *err)
 {
-       int eaten;
+       /* parse_object_buffer() will set eaten to 0 if free() will be needed */
+       int eaten = 1;
        int ret = 0;
        unsigned long size;
        void *buf = get_obj(oid, obj, &size, &eaten);