[PATCH 04/11] xi: fix memory leak in ProcXListProperties and ProcXIListProperties

Nicolas PENINGUY nico at lostgeeks.org
Fri Mar 25 16:34:39 PDT 2011


On Fri, 2011-03-25 at 20:41 +0200, Tiago Vignatti wrote:
> diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
> index 83ce930..b55e7f3 100644
> --- a/Xi/xiproperty.c
> +++ b/Xi/xiproperty.c
> @@ -904,8 +904,8 @@ ProcXListDeviceProperties (ClientPtr client)
>      {
>          client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
>          WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
> -        free(atoms);
>      }
> +    free(atoms);
>      return rc;
>  }

I think it's wrong, because if natoms equals 0, list_atoms() doesn't
allocate anything and sets atoms to NULL.


>  
> @@ -1148,8 +1148,8 @@ ProcXIListProperties(ClientPtr client)
>      {
>          client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
>          WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
> -        free(atoms);
>      }
> +    free(atoms);
>      return rc;
>  }

Same here.

Nicolas




More information about the xorg-devel mailing list