Re: [PATCH] win32: syslog: prevent potential realloc memory leak
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 26, 2015, 04:25 UTC
- Message-ID
- <xmqqzj96mame.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <CABPQNSbCF7P23K+uj00PmjJkr=19t=W5wCN0-jweBJYEWgUWRw@mail.gmail.com>
Erik Faye-Lund <kusmabite@gmail.com> writes:
Show 16 quoted lines
> Sorry for very late reply. I had a bug in my mail rules that caused > this email to skip my inbox. That should be fixed now. > > On Mon, Dec 15, 2014 at 7:11 PM, Junio C Hamano <gitster@pobox.com> wrote: > ... >> Regardless of that funny %1 business, I notice in >> >> http://msdn.microsoft.com/en-us/library/windows/desktop/aa363679%28v=vs.85%29.aspx >> >> that each element of lpStrings array that is passed to ReportEvent() >> is limited to 32k or so. Wouldn't it make it a lot simpler if we >> removed the dynamic allocation and use a fixed sized 32k buffer here >> (and truncate the result as necessary)? That would make the "leak" >> disappear automatically. > > That's a very good point. Yes, I think that makes more sense.
OK, so I'd expect a simpler non-reallocating code to materialize and will drop Arjun's patch for now.
Thanks.