[PATCH libICE 13/13] make sure buffer is zero filled and report if, allocation failed

Emil Velikov emil.l.velikov at gmail.com
Tue Oct 31 15:01:23 UTC 2017


On 18 October 2017 at 17:09, walter harms <wharms at bfs.de> wrote:
>
>  make sure buffer is zero filled and
>  report if allocation failed
>
>  Signed-off-by: Walter Harms <wharms at bfs.de>
>
> ---
>  src/listenwk.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/listenwk.c b/src/listenwk.c
> index 7517ea8..bc1da76 100644
> --- a/src/listenwk.c
> +++ b/src/listenwk.c
> @@ -64,11 +64,14 @@ IceListenForWellKnownConnections (
>         return (0);
>      }
>
> -    if ((listenObjs = malloc (transCount * sizeof (struct _IceListenObj))) == NULL)
> +    listenObjs = calloc (transCount, sizeof (struct _IceListenObj));
> +    if ( listenObjs == NULL)
>      {
malloc should be fine here, right - otherwise you want to mention why
in the commit message.
The *listenObjsRet = NULL; seems to be a must.

-Emil


More information about the xorg-devel mailing list