[MPlayer-dev-eng] [PATCH] libmenu: fill allocated memory for path variable with 0, fixes menu_keepdir
Guillaume LECERF
foxcore at gmail.com
Tue Jun 3 20:24:23 CEST 2008
On Tue, Jun 3, 2008 at 7:33 PM, Aurelien Jacobs <aurel at gnuage.org> wrote:
> Guillaume LECERF wrote:
>
>> On Tue, Jun 3, 2008 at 2:27 PM, Guillaume LECERF <foxcore at gmail.com> wrote:
>> > freepath = path;
>> > path[st.st_size] = '\0';
>>
>> Further simplifications.
>
> No need to memset the whole path to 0. Just setting path[st.st_size] = 0
> should be enough, as long as it's done before the call to stat().
Setting path[st.st_size] = 0 before the call to stat() implies
splitting the test in two, which will result in a code duplication (2x
free(path); path = null;)
This patch is IMHO the less intrusive one, and btw reduce the code.
What the problem with setting the whole path to 0 ?
--
Guillaume LECERF
GeeXboX developer - www.geexbox.org
More information about the MPlayer-dev-eng
mailing list