{"thread":{"id":"13997","subject":"[PATCH] builtin-rerere: fix a small leak","startedAt":"2008-06-17T07:23:31Z","lastAt":"2008-06-17T10:34:29Z","messageCount":2,"participants":["Junio C Hamano","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"80113","messageId":"7vk5go7cek.fsf@gitster.siamese.dyndns.org","threadId":"13997","inReplyTo":null,"subject":"[PATCH] builtin-rerere: fix a small leak","fromName":"Junio C Hamano","fromEmail":"junio@pobox.com","sentAt":"2008-06-17T07:23:31Z","receivedAt":"2008-06-17T07:23:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The data read from MERGE_RR file is kept in path-list by hanging textual\n40-byte conflict signature to path of the blob that contains the\nconflict.  The signature is strdup'ed twice, and the second copy is given\nto the path-list, leaking the first copy.\n\nSigned-off-by: Junio C Hamano <junio@pobox.com>\n---\n * Am I overlooking something obvious, or is this simply a never-reviewed\n   buglet that nobody has noticed for a long time?\n\n builtin-rerere.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-rerere.c b/builtin-rerere.c\nindex 5c81142..85222d9 100644\n--- a/builtin-rerere.c\n+++ b/builtin-rerere.c\n@@ -43,7 +43,7 @@ static void read_rr(struct path_list *rr)\n \t\t\t; /* do nothing */\n \t\tif (i == sizeof(buf))\n \t\t\tdie(\"filename too long\");\n-\t\tpath_list_insert(buf, rr)->util = xstrdup(name);\n+\t\tpath_list_insert(buf, rr)->util = name;\n \t}\n \tfclose(in);\n }\n"},{"id":"80127","messageId":"alpine.DEB.1.00.0806171133330.6439@racer","threadId":"13997","inReplyTo":"7vk5go7cek.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] builtin-rerere: fix a small leak","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-06-17T10:34:29Z","receivedAt":"2008-06-17T10:34:29Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 17 Jun 2008, Junio C Hamano wrote:\n\n> The data read from MERGE_RR file is kept in path-list by hanging textual\n> 40-byte conflict signature to path of the blob that contains the\n> conflict.  The signature is strdup'ed twice, and the second copy is given\n> to the path-list, leaking the first copy.\n> \n> Signed-off-by: Junio C Hamano <junio@pobox.com>\n> ---\n>  * Am I overlooking something obvious, or is this simply a never-reviewed\n>    buglet that nobody has noticed for a long time?\n\nI think that it was a never-reviewed buglet.  The only code path leading \nto read_rr passes merge_rr, which has strdup_paths == 1.\n\nAcked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\nCiao,\nDscho\n"}]}