Fritjof Bornebusch wrote:

> Hi tech,
> 
> there is an unnecessary NULL check before calling free.
> 
> fritjof
> 
> Index: xmalloc.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/rcs/xmalloc.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 xmalloc.c
> --- xmalloc.c   7 Jun 2009 08:39:13 -0000       1.4
> +++ xmalloc.c   31 May 2014 19:19:18 -0000
> @@ -76,8 +76,6 @@ xrealloc(void *ptr, size_t nmemb, size_t
>  void
>  xfree(void *ptr)
>  {
> -       if (ptr == NULL)
> -               errx(1, "xfree: NULL pointer given as argument");
>         free(ptr);
>  }

Looking for xmalloc/xfree on the internet it seems this behaviour is 
intended. On OpenBSD at least malloc(3) has a reference to xmalloc by means 
of its 'X' malloc option.

Reply via email to