summaryrefslogtreecommitdiff
path: root/ref-filter.c
diff options
context:
space:
mode:
authorOlga Telezhnaya <olyatelezhnaya@gmail.com>2018-07-17 08:22:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-07-17 22:04:29 (GMT)
commit04f6ee1a58ec988b3260846812349b39dc08d06b (patch)
tree5338dffe9ec9fda80d6569cec97150ed27c71aac /ref-filter.c
parent20a9c156198bf195b7d32ef9a73ba01b8b19f52c (diff)
downloadgit-04f6ee1a58ec988b3260846812349b39dc08d06b.zip
git-04f6ee1a58ec988b3260846812349b39dc08d06b.tar.gz
git-04f6ee1a58ec988b3260846812349b39dc08d06b.tar.bz2
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 <olyatelezhnaya@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ref-filter.c')
-rw-r--r--ref-filter.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ref-filter.c b/ref-filter.c
index 27733ef..8db7ca9 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -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);