[PATCH 00/16] More static analysis fixes for Xlib

Ander Conselvan de Oliveira ander.conselvan-de-oliveira at nokia.com
Wed Apr 13 00:18:51 PDT 2011


Thanks for reviewing. See comments inline.

On 04/13/2011 05:21 AM, ext Alan Coopersmith wrote:
> On 04/12/11 02:11 AM, conselvan2 at gmail.com wrote:

[...]

>    [02/16] FSWrap: fix potential leak in copy_string_list
>    http://patchwork.freedesktop.org/patch/4760/
>    (Though it should only leak on platforms where malloc(0) doesn't return NULL,
>     it was still wasting time getting to the point it returned NULL.)

On my system, glibc 2.11.1 on x86_64, malloc(0) returns a non-null pointer.

>    [03/16] Fix leaks in _XimEncodingNegotiation error paths.
>    http://patchwork.freedesktop.org/patch/4758/
>    (You don't actually need to check for null before calling Xfree(), but that
>     was in the original code already.)

I can amend this before sending a pull request.

[...]

>    [10/16] Fix memory leak on _XimGetAttributeID error path
>    http://patchwork.freedesktop.org/patch/4768/
>    (Could be squashed with patch 5, since it's the same bug in the same
>     function, just replicated on a different line number.)

Will do that before sending the pull request.

[...]

> Not yet ready to call reviewed:
>
>    [11/16] om: Fix memory leak on get_font_name error path
>    http://patchwork.freedesktop.org/patch/4764/
>    Don't you also need to free(pattern) on all the other return NULL
>    calls in this function?   Perhaps a candidate for a goto, since
>    the end of the function is Xfree(pattern); return rotate_font_ptr
>    and rotate_font_ptr isn't allocated until after the last error
>    check, so would still be NULL.

You're right. Fixed patch coming soon.


Cheers,
Ander


More information about the xorg-devel mailing list