[MPlayer-dev-eng] [PATCH] libmenu: fill allocated memory for path variable with 0, fixes menu_keepdir

Benjamin Zores ben at geexbox.org
Thu Jun 5 21:47:39 CEST 2008


Guillaume LECERF a écrit :
> On Tue, Jun 3, 2008 at 8:42 PM, Aurelien Jacobs <aurel at gnuage.org> wrote:
>>> Setting path[st.st_size] = 0 before the call to stat() implies
>>> splitting the test in two
>> No. It implies setting path[st.st_size] = 0 before the whole test
>> (before the if()).
> 
> OK, I got it now. The st struct is used twice, once for
> MENU_KEEP_PATH, and once for the path it contains.
> So I thought that the right st.size was the 2nd one. Then I realized
> that the size of MENU_KEEP_PATH and the length of the path is contains
> are actually equals.
> 
>>> What the problem with setting the whole path to 0 ?
>> It uselessly set st.st_size-1 bytes to 0.
> 
> I'm ok with you for a speed-critical section of the code, but in this
> case, it _should_ have been good enough.
> 
> BTW patches attached (fix + cosmetic).

Both applied.

Ben



More information about the MPlayer-dev-eng mailing list