git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] diff --no-index: don't leak buffers in queue_diff
@ 2012-05-16 14:50 Bobby Powers
  0 siblings, 0 replies; only message in thread
From: Bobby Powers @ 2012-05-16 14:50 UTC (permalink / raw)
  To: git; +Cc: Bobby Powers

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>
---
 diff-no-index.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/diff-no-index.c b/diff-no-index.c
index 3080b66..f0b0010 100644
--- a/diff-no-index.c
+++ b/diff-no-index.c
@@ -123,8 +123,8 @@ static int queue_diff(struct diff_options *o,
 		}
 		string_list_clear(&p1, 0);
 		string_list_clear(&p2, 0);
-		strbuf_reset(&buffer1);
-		strbuf_reset(&buffer2);
+		strbuf_release(&buffer1);
+		strbuf_release(&buffer2);
 
 		return ret;
 	} else {
-- 
1.7.10.2.521.g8ddb639

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-05-16 14:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-16 14:50 [PATCH] diff --no-index: don't leak buffers in queue_diff Bobby Powers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).