[PATCH] Remove more superfluous if(p) checks around free(p)
Alan Coopersmith
alan.coopersmith at oracle.com
Wed Jun 9 09:46:09 PDT 2010
Matt Turner wrote:
> --- a/xkb/ddxList.c
> +++ b/xkb/ddxList.c
> @@ -208,10 +208,8 @@ char tmpname[PATH_MAX];
> return BadImplementation;
> }
> list->nFound[what]= 0;
> - if (buf) {
> - free(buf);
> - buf = NULL;
> - }
> + free(buf);
> + buf = NULL;
> buf = malloc(PATH_MAX * sizeof(char));
> if (!buf)
> return BadAlloc;
While you didn't introduce it, you could get rid of the buf = NULL setting,
though presumably the compiler optimizes it away when it sees buf overwritten
on the next line without ever referencing the NULL pointer.
Even with that tiny nit,
Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
--
-Alan Coopersmith- alan.coopersmith at oracle.com
Oracle Solaris Platform Engineering: X Window System
More information about the xorg-devel
mailing list