[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] Fix memory leak on `realloc' failure
From: |
Andy Wingo |
Subject: |
Re: [PATCH 1/2] Fix memory leak on `realloc' failure |
Date: |
Tue, 22 Apr 2014 22:25:56 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
On Sat 12 Apr 2014 08:59, Dmitry Bogatov <address@hidden> writes:
> * Dmitry Bogatov <address@hidden> [2014-04-10 20:52:43+0400]
>> > > + {
>> > > + free (nargv);
>> > > return 0L;
>> > > + }
>> > > else
>> > > nargv[nargi++] = narg;
>> > I don't understand this. In both cases, free() will be called with an
>> > argument of 0, which does nothing.
>> My bad. It does not fix problem, that if realloc fails, it does not free
>> memory, but we blindly assign, losing pointer to previous memory
>> chunk.
>
> Attached new version. Please, take a look.
Applied, thanks. I altered the commit log; please take a look and
submit in that format in the future. The "magit" emacs mode makes it
easy to produce this format.
Cheers,
Andy
--
http://wingolog.org/