{"thread":{"id":"62169","subject":"[PATCH] commit-graph: remove unnecessary UNLEAK","startedAt":"2024-09-22T13:40:45Z","lastAt":"2024-09-22T13:40:45Z","messageCount":1,"participants":["René Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"503214","messageId":"c3a712d5-8e50-453d-be90-f5bf34de744c@web.de","threadId":"62169","inReplyTo":null,"subject":"[PATCH] commit-graph: remove unnecessary UNLEAK","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2024-09-22T13:40:42Z","receivedAt":"2024-09-22T13:40:45Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"When f4dbdfc4d5 (commit-graph: clean up leaked memory during write,\n2018-10-03) added the UNLEAK, it was right before a call to die_errno().\ne103f7276f (commit-graph: return with errors during write, 2019-06-12)\nmade it unnecessary, as it was then followed by a free() call for the\nallocated string.\n\nThe code moved to write_commit_graph_file() in the meantime and the\nstring pointer is now part of a struct, but the function's only caller\nstill cleans up the allocation.  Drop the superfluous UNLEAK.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\n commit-graph.c | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/commit-graph.c b/commit-graph.c\nindex aa6e08eb39..5bd89c0acd 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -2055,7 +2055,6 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)\n \t}\n\n \tif (safe_create_leading_directories(ctx->graph_name)) {\n-\t\tUNLEAK(ctx->graph_name);\n \t\terror(_(\"unable to create leading directories of %s\"),\n \t\t\tctx->graph_name);\n \t\treturn -1;\n--\n2.46.0\n"}]}