git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / Atom feed
* [PATCH v1 1/1] sequencer: fix a memory leak in sequencer_continue()
@ 2019-11-28 23:02 Alban Gruin
  0 siblings, 0 replies; only message in thread
From: Alban Gruin @ 2019-11-28 23:02 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Johannes Schindelin, Phillip Wood, Alban Gruin

When continuing an interactive rebase after a merge conflict was solved,
if the resolution could not be committed, sequencer_continue() would
return early without releasing its todo list, resulting in a memory
leak.  This plugs this leak by jumping to the end of the function, where
the todo list is deallocated.

Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
---
I found this while adding support of rebase.missingCommitCheck to `git
rebase --continue'.

 sequencer.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sequencer.c b/sequencer.c
index 8952cfa89b..64227a71e5 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -4208,8 +4208,10 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)
 	if (is_rebase_i(opts)) {
 		if ((res = read_populate_todo(r, &todo_list, opts)))
 			goto release_todo_list;
-		if (commit_staged_changes(r, opts, &todo_list))
-			return -1;
+		if (commit_staged_changes(r, opts, &todo_list)) {
+			res = -1;
+			goto release_todo_list;
+		}
 	} else if (!file_exists(get_todo_path(opts)))
 		return continue_single_pick(r);
 	else if ((res = read_populate_todo(r, &todo_list, opts)))
-- 
2.24.0


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

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-28 23:02 [PATCH v1 1/1] sequencer: fix a memory leak in sequencer_continue() Alban Gruin

git@vger.kernel.org list mirror (unofficial, one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git