From: Christian Couder <chriscool@tuxfamily.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Ramkumar Ramachandra <artagnon@gmail.com>,
Jonathan Nieder <jrnieder@gmail.com>,
Nick Bowler <nbowler@elliptictech.com>
Subject: [PATCH 1/2] sequencer: fix leaked todo_list memory
Date: Fri, 04 May 2012 21:40:33 +0200 [thread overview]
Message-ID: <20120504194035.25080.49271.chriscool@tuxfamily.org> (raw)
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
Hi,
This is a very small series to fix a few memory leaks.
It will not fix the main leaks but it's a start.
Regards,
Christian.
sequencer.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/sequencer.c b/sequencer.c
index f83cdfd..aa4c1a4 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -892,6 +892,7 @@ static int continue_single_pick(void)
static int sequencer_continue(struct replay_opts *opts)
{
struct commit_list *todo_list = NULL;
+ int res;
if (!file_exists(git_path(SEQ_TODO_FILE)))
return continue_single_pick();
@@ -907,8 +908,11 @@ static int sequencer_continue(struct replay_opts *opts)
}
if (index_differs_from("HEAD", 0))
return error_dirty_index(opts);
- todo_list = todo_list->next;
- return pick_commits(todo_list, opts);
+ res = pick_commits(todo_list->next, opts);
+
+ free_commit_list(todo_list);
+
+ return res;
}
static int single_pick(struct commit *cmit, struct replay_opts *opts)
@@ -921,6 +925,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)
{
struct commit_list *todo_list = NULL;
unsigned char sha1[20];
+ int res;
if (opts->subcommand == REPLAY_NONE)
assert(opts->revs);
@@ -977,5 +982,9 @@ int sequencer_pick_revisions(struct replay_opts *opts)
}
save_head(sha1_to_hex(sha1));
save_opts(opts);
- return pick_commits(todo_list, opts);
+ res = pick_commits(todo_list, opts);
+
+ free_commit_list(todo_list);
+
+ return res;
}
--
1.7.10.579.g68891.dirty
reply other threads:[~2012-05-04 19:46 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=20120504194035.25080.49271.chriscool@tuxfamily.org \
--to=chriscool@tuxfamily.org \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=nbowler@elliptictech.com \
/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).