update-index: fix a memleak
authorStefan Beller <sbeller@google.com>
Sat, 21 Mar 2015 00:28:01 +0000 (17:28 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 22 Mar 2015 19:26:31 +0000 (12:26 -0700)
`old` is not used outside the loop and would get lost
once we reach the goto.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/update-index.c
index 587898624c0550749a9a241e2742785f20ec1bd5..6271b54adc24c8765ca0b179faf53f6af86dc630 100644 (file)
@@ -584,6 +584,7 @@ static int do_reupdate(int ac, const char **av,
                path = xstrdup(ce->name);
                update_one(path);
                free(path);
+               free(old);
                if (save_nr != active_nr)
                        goto redo;
        }