{"thread":{"id":"30537","subject":"[PATCH] diff --no-index: don't leak buffers in queue_diff","startedAt":"2012-05-16T14:50:31Z","lastAt":"2012-05-16T14:50:31Z","messageCount":1,"participants":["Bobby Powers"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"191592","messageId":"1337179831-23461-1-git-send-email-bobbypowers@gmail.com","threadId":"30537","inReplyTo":null,"subject":"[PATCH] diff --no-index: don't leak buffers in queue_diff","fromName":"Bobby Powers","fromEmail":"bobbypowers@gmail.com","sentAt":"2012-05-16T14:50:31Z","receivedAt":"2012-05-16T14:50:31Z","isPatch":true,"sender":{"key":"bobbypowers@gmail.com","avatar":"https://avatars.githubusercontent.com/u/854918?v=4"},"body":"queue_diff uses two strbufs, and at the end of the function\nstrbuf_reset was called.  This only reset the length of the buffer -\nany allocated memory was leaked.  Using strbuf_release fixes this.\n\nSigned-off-by: Bobby Powers <bobbypowers@gmail.com>\n---\n diff-no-index.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/diff-no-index.c b/diff-no-index.c\nindex 3080b66..f0b0010 100644\n--- a/diff-no-index.c\n+++ b/diff-no-index.c\n@@ -123,8 +123,8 @@ static int queue_diff(struct diff_options *o,\n \t\t}\n \t\tstring_list_clear(&p1, 0);\n \t\tstring_list_clear(&p2, 0);\n-\t\tstrbuf_reset(&buffer1);\n-\t\tstrbuf_reset(&buffer2);\n+\t\tstrbuf_release(&buffer1);\n+\t\tstrbuf_release(&buffer2);\n \n \t\treturn ret;\n \t} else {\n-- \n1.7.10.2.521.g8ddb639\n"}]}