add_reflog_for_walk: avoid memory leak
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 4 May 2017 13:58:42 +0000 (15:58 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 8 May 2017 03:18:20 +0000 (12:18 +0900)
commit5026b471751092ab971f3d4ae46320bc8ce40ff5
tree56917f1973c1e3f89ca6ed3919b53fb33c25e3a5
parent7c565a6b2d8bf7fe989c85dc75df7fabc8113f40
add_reflog_for_walk: avoid memory leak

We free()d the `log` buffer when dwim_log() returned 1, but not when it
returned a larger value (which meant that it still allocated the buffer
but we simply ignored it).

While in the vicinity, make sure that the `reflogs` structure as well as
the `branch` variable are released properly, too.

Identified by Coverity.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reflog-walk.c