{"thread":{"id":"30425","subject":"[PATCH 1/2] sequencer: fix leaked todo_list memory","startedAt":"2012-05-04T19:40:33Z","lastAt":"2012-05-04T19:40:33Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"190791","messageId":"20120504194035.25080.49271.chriscool@tuxfamily.org","threadId":"30425","inReplyTo":null,"subject":"[PATCH 1/2] sequencer: fix leaked todo_list memory","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2012-05-04T19:40:33Z","receivedAt":"2012-05-04T19:40:33Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\nHi,\n\nThis is a very small series to fix a few memory leaks.\nIt will not fix the main leaks but it's a start.\n\nRegards,\nChristian.\n\n sequencer.c | 15 ++++++++++++---\n 1 file changed, 12 insertions(+), 3 deletions(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex f83cdfd..aa4c1a4 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -892,6 +892,7 @@ static int continue_single_pick(void)\n static int sequencer_continue(struct replay_opts *opts)\n {\n \tstruct commit_list *todo_list = NULL;\n+\tint res;\n \n \tif (!file_exists(git_path(SEQ_TODO_FILE)))\n \t\treturn continue_single_pick();\n@@ -907,8 +908,11 @@ static int sequencer_continue(struct replay_opts *opts)\n \t}\n \tif (index_differs_from(\"HEAD\", 0))\n \t\treturn error_dirty_index(opts);\n-\ttodo_list = todo_list->next;\n-\treturn pick_commits(todo_list, opts);\n+\tres = pick_commits(todo_list->next, opts);\n+\n+\tfree_commit_list(todo_list);\n+\n+\treturn res;\n }\n \n static int single_pick(struct commit *cmit, struct replay_opts *opts)\n@@ -921,6 +925,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)\n {\n \tstruct commit_list *todo_list = NULL;\n \tunsigned char sha1[20];\n+\tint res;\n \n \tif (opts->subcommand == REPLAY_NONE)\n \t\tassert(opts->revs);\n@@ -977,5 +982,9 @@ int sequencer_pick_revisions(struct replay_opts *opts)\n \t}\n \tsave_head(sha1_to_hex(sha1));\n \tsave_opts(opts);\n-\treturn pick_commits(todo_list, opts);\n+\tres = pick_commits(todo_list, opts);\n+\n+\tfree_commit_list(todo_list);\n+\n+\treturn res;\n }\n-- \n1.7.10.579.g68891.dirty\n"}]}