[Lcdproc] [PATCH] Missing NULL malloc() check in server/menuitem.c
bsdfan at nurfuerspam.de
Sat Jun 6 15:40:20 UTC 2009
Markus Dolze wrote:
> Andre Guibert de Bruet wrote:
>> I have addressed a bunch of malloc-related issues this source file in
>> the attached patch (Against HEAD). I have a list of additional issues
>> with menuitem.c which I will address at a later date.
>> Could the attached patch be committed upon review?
> I had a look at your patch and the menu* part. It is perhaps one of
> the most complex part of LCDproc.
> Tracing from menuitem_create to all more specific menuitem_create_*()
> functions and the calling functions I was puzzled by the result
> handling and rewrote parts of it. Patch is attached.
> Some remarks:
> 1. All calls to malloc are checked for NULL now (based on
> Andre's patch).
> 2. All calls to strdup are checked as well, because subsequent calls to
> strlen(NULL) will result in core dump.
> 3. It is not necessary to free allocated memory and duplicates string in
> menuitem_create_*() IF menuitem_destroy() is called (the latter frees
> all allocated strings). However, I am not sure if I need to
> initialize all pointer to NULL before.
> 4. All calls to menu_create() are checked for NULL, exiting the current
> function in most cases.
> 5. I moved the creation of the test menu into its own function (as a
> result of 3).
I committed all ot these to cvs HEAD.
Merge to: stable-0-5-x: pending
Merge to: lcdproc-0-5-3: pending
More information about the LCDproc