git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH v2] commit-graph: Fix missing closedir in expire_commit_graphs
@ 2022-09-19 14:14 Miaoqian Lin
  2022-09-19 15:04 ` Derrick Stolee
  0 siblings, 1 reply; 3+ messages in thread
From: Miaoqian Lin @ 2022-09-19 14:14 UTC (permalink / raw)
  To: git, Junio C Hamano, Derrick Stolee, René Scharfe; +Cc: linmq006

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] commit-graph: Fix missing closedir in expire_commit_graphs
  2022-09-19 14:14 [PATCH v2] commit-graph: Fix missing closedir in expire_commit_graphs Miaoqian Lin
@ 2022-09-19 15:04 ` Derrick Stolee
  2022-09-19 17:41   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Derrick Stolee @ 2022-09-19 15:04 UTC (permalink / raw)
  To: Miaoqian Lin, git, Junio C Hamano, René Scharfe

On 9/19/2022 10:14 AM, Miaoqian Lin wrote:
> The function calls opendir() but missing the corresponding
> closedir() before exit the function.
> Add missing closedir() to fix it.

Thanks for the patch, Miaoqian.

I only have a very tiny nitpick with the line breaks in your
commit message. Either the "Add missing..." sentence should
start immediately after the previous sentence or have another
line break between the paragraphs. This shouldn't merit a
re-roll, but keep it in mind for future contributions.

>  out:
> +	if(dir)
> +		closedir(dir);
>  	strbuf_release(&path);
>  }

This change looks correct to me. Thanks!
-Stolee

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] commit-graph: Fix missing closedir in expire_commit_graphs
  2022-09-19 15:04 ` Derrick Stolee
@ 2022-09-19 17:41   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2022-09-19 17:41 UTC (permalink / raw)
  To: Derrick Stolee; +Cc: Miaoqian Lin, git, René Scharfe

Derrick Stolee <derrickstolee@github.com> writes:

> On 9/19/2022 10:14 AM, Miaoqian Lin wrote:
>> The function calls opendir() but missing the corresponding
>> closedir() before exit the function.
>> Add missing closedir() to fix it.
>
> Thanks for the patch, Miaoqian.
>
> I only have a very tiny nitpick with the line breaks in your
> commit message. Either the "Add missing..." sentence should
> start immediately after the previous sentence or have another
> line break between the paragraphs. This shouldn't merit a
> re-roll, but keep it in mind for future contributions.
>
>>  out:
>> +	if(dir)
>> +		closedir(dir);
>>  	strbuf_release(&path);
>>  }
>
> This change looks correct to me. Thanks!
> -Stolee

Thanks, both.  Looking good.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-19 17:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19 14:14 [PATCH v2] commit-graph: Fix missing closedir in expire_commit_graphs Miaoqian Lin
2022-09-19 15:04 ` Derrick Stolee
2022-09-19 17:41   ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).