Re: [PATCHv3 6/6] entry.c: fix a memleak
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 31, 2015, 19:12 UTC
- Message-ID
- <xmqqmw2tq8uk.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <20150331083647.GA2248@serenity.lan>
John Keeping <john@keeping.me.uk> writes:
Show 13 quoted lines
> On Mon, Mar 30, 2015 at 06:22:11PM -0700, Stefan Beller wrote: >> From: John Keeping <john@keeping.me.uk> >> >> stream_blob_to_fd() always frees the filter now, so there is no memory >> leak in entry.c:152 just before the `goto finish`. >> >> Signed-off-by: John Keeping <john@keeping.me.uk> >> Signed-off-by: Stefan Beller <sbeller@google.com> >> --- >> >> I added Johns signoff here tentatively, John can you confirm the sign off? > > Signed-off-by: John Keeping <john@keeping.me.uk>
Thanks. I'll queue with a retitle, as this no longer is about entry.c at all.
Show 24 quoted lines
>
>> streaming.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/streaming.c b/streaming.c
>> index 2ff036a..811fcc2 100644
>> --- a/streaming.c
>> +++ b/streaming.c
>> @@ -507,8 +507,11 @@ int stream_blob_to_fd(int fd, unsigned const char *sha1, struct stream_filter *f
>> int result = -1;
>>
>> st = open_istream(sha1, &type, &sz, filter);
>> - if (!st)
>> + if (!st) {
>> + if (filter)
>> + free_stream_filter(filter);
>> return result;
>> + }
>> if (type != OBJ_BLOB)
>> goto close_and_exit;
>> for (;;) {
>> --
>> 2.3.0.81.gc37f363
>>