Skip to content

Commit 176a335

Browse files
bpowersgitster
authored andcommitted
diff --no-index: don't leak buffers in queue_diff
queue_diff uses two strbufs, and at the end of the function strbuf_reset was called. This only reset the length of the buffer - any allocated memory was leaked. Using strbuf_release fixes this. Signed-off-by: Bobby Powers <bobbypowers@gmail.com> Reviewed-by: René Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent f3999e0 commit 176a335

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

diff-no-index.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ static int queue_diff(struct diff_options *o,
123123
}
124124
string_list_clear(&p1, 0);
125125
string_list_clear(&p2, 0);
126-
strbuf_reset(&buffer1);
127-
strbuf_reset(&buffer2);
126+
strbuf_release(&buffer1);
127+
strbuf_release(&buffer2);
128128

129129
return ret;
130130
} else {

0 commit comments

Comments
 (0)