missing freeing previous data struction when new allocation fails

Kristian Høgsberg krh at bitplanet.net
Mon Nov 22 08:06:30 PST 2010


On Wed, Nov 17, 2010 at 10:16 PM, 林昊翔 <linhaoxiang at gmail.com> wrote:
> The scenario is:
> struct A *foo()
> {
>     A *a;
>
>     a = malloc(sizeof(A));
>     if (a == NULL)
>         return NULL;
>
>     a->b = malloc(sizeof(B));
>     if (a->b == NULL)
>         return NULL;
>
>     return a;
> }

You're right, there's a bunch of those in the code.  Could you please
create your patches by committing the changes and then either attach
the output of git format-patch -1 (where -1 means "one commit", use
whatever number of patches you have) or even better use git send-email
-1 --to=wayland-devel at lists.freedesktop.org.

Thanks,
Kristian


More information about the wayland-devel mailing list