git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] commit-graph: Fix missing closedir in expire_commit_graphs

From
MLMiaoqian Lin <linmq006@gmail.com>
Date
Sep 19, 2022, 14:14 UTC
Message-ID
<20220919141441.5644-1-linmq006@gmail.com>

The function calls opendir() but missing the corresponding closedir() before exit the function. Add missing closedir() to fix it.

Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
changes in v2:
- add if (dir) before closedir(), as suggested by Derrick.
---
 commit-graph.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/commit-graph.c b/commit-graph.c
index 06f7d9e0b6af..a7d875593288 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -2265,6 +2265,8 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
 	}
 
 out:
+	if(dir)
+		closedir(dir);
 	strbuf_release(&path);
 }
 
-- 
2.25.1
Next: Derrick Stolee
Message 1 of 3 in “commit-graph: Fix missing closedir in expire_commit_graphs”
  1. commit-graph: Fix missing closedir in expire_commit_graphsMiaoqian Lin, Sep 19, 2022
  2. Derrick StoleeSep 19, 2022
  3. Junio C HamanoSep 19, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.