# [PATCH] plug a DIR buffer leak in rerere.c

3 messages from 2011-05-26 to 2011-05-26. Participants: Jim Meyering, Junio C Hamano.
Thread: https://gitlist.dev/t/27465

## Jim Meyering, 2011-05-26 13:55

Subject: [PATCH] plug a DIR buffer leak in rerere.c
Message-ID: <8762ox7ehl.fsf@rho.meyering.net>
URL: https://gitlist.dev/e/8762ox7ehl.fsf%40rho.meyering.net

```

* rerere.c (rerere_gc): Don't leak a DIR buffer.
---
Spotted by coverity, and since I was already looking at this
particular file...
Like the preceding patch, this is relative to "next".

 rerere.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/rerere.c b/rerere.c
index cb8e5ba..dcb525a 100644
--- a/rerere.c
+++ b/rerere.c
@@ -745,6 +745,7 @@ void rerere_gc(struct string_list *rr)
 		if (then < now - cutoff * 86400)
 			string_list_append(&to_remove, e->d_name);
 	}
+	closedir(dir);
 	for (i = 0; i < to_remove.nr; i++)
 		unlink_rr_item(to_remove.items[i].string);
 	string_list_clear(&to_remove, 0);
--
1.7.5.2.660.g9f46c

```

## Junio C Hamano, 2011-05-26 18:21

Subject: Re: [PATCH] plug a DIR buffer leak in rerere.c
Message-ID: <7v7h9dxqzj.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v7h9dxqzj.fsf%40alter.siamese.dyndns.org
In-Reply-To: <8762ox7ehl.fsf@rho.meyering.net>

```
Thanks; I assume both of these are signed-off?

```

## Jim Meyering, 2011-05-26 18:32

Subject: Re: [PATCH] plug a DIR buffer leak in rerere.c
Message-ID: <877h9d48ji.fsf@rho.meyering.net>
URL: https://gitlist.dev/e/877h9d48ji.fsf%40rho.meyering.net
In-Reply-To: <7v7h9dxqzj.fsf@alter.siamese.dyndns.org>

```
Junio C Hamano wrote:
> Thanks; I assume both of these are signed-off?

Yes.  Sorry about the omission.

```
