From: Bobby Powers <bobbypowers@gmail.com>
To: git@vger.kernel.org
Cc: Bobby Powers <bobbypowers@gmail.com>
Subject: [PATCH] diff --no-index: don't leak buffers in queue_diff
Date: Wed, 16 May 2012 10:50:31 -0400 [thread overview]
Message-ID: <1337179831-23461-1-git-send-email-bobbypowers@gmail.com> (raw)
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
reply other threads:[~2012-05-16 14:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1337179831-23461-1-git-send-email-bobbypowers@gmail.com \
--to=bobbypowers@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).