[PATCH 1/2] Remove more superfluous if(p) checks around free(p).
Matt Turner
mattst88 at gmail.com
Mon Nov 8 15:46:03 PST 2010
On Mon, Nov 8, 2010 at 5:35 PM, Cyril Brulebois <kibi at debian.org> wrote:
> This patch has been generated by the following Coccinelle semantic patch:
>
> @@
> expression E;
> @@
> - if (E)
> - free(E);
> + free(E);
>
> Signed-off-by: Cyril Brulebois <kibi at debian.org>
> ---
> hw/dmx/glxProxy/glxcmds.c | 2 +-
> hw/dmx/glxProxy/glxext.c | 18 +++++++++---------
> 2 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
> index a9744e1..7602128 100644
> --- a/hw/dmx/glxProxy/glxcmds.c
> +++ b/hw/dmx/glxProxy/glxcmds.c
> @@ -2565,7 +2565,7 @@ int __glXClientInfo(__GLXclientState *cl, GLbyte *pc)
>
> cl->GLClientmajorVersion = req->major;
> cl->GLClientminorVersion = req->minor;
> - if (cl->GLClientextensions) free(cl->GLClientextensions);
> + free(cl->GLClientextensions);
> buf = (const char *)(req+1);
> cl->GLClientextensions = strdup(buf);
>
> diff --git a/hw/dmx/glxProxy/glxext.c b/hw/dmx/glxProxy/glxext.c
> index a8fc0a8..886b317 100644
> --- a/hw/dmx/glxProxy/glxext.c
> +++ b/hw/dmx/glxProxy/glxext.c
> @@ -77,10 +77,10 @@ static void ResetClientState(int clientIndex)
> Display **keep_be_displays;
> int i;
>
> - if (cl->returnBuf) free(cl->returnBuf);
> - if (cl->currentContexts) free(cl->currentContexts);
> - if (cl->currentDrawables) free(cl->currentDrawables);
> - if (cl->largeCmdBuf) free(cl->largeCmdBuf);
> + free(cl->returnBuf);
> + free(cl->currentContexts);
> + free(cl->currentDrawables);
> + free(cl->largeCmdBuf);
>
> for (i=0; i< screenInfo.numScreens; i++) {
> if (cl->be_displays[i])
> @@ -97,7 +97,7 @@ static void ResetClientState(int clientIndex)
> */
> cl->GLClientmajorVersion = 1;
> cl->GLClientminorVersion = 0;
> - if (cl->GLClientextensions) free(cl->GLClientextensions);
> + free(cl->GLClientextensions);
>
> memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *));
> }
> @@ -222,10 +222,10 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
> {
> if (cx->idExists || cx->isCurrent) return GL_FALSE;
>
> - if (cx->feedbackBuf) free(cx->feedbackBuf);
> - if (cx->selectBuf) free(cx->selectBuf);
> - if (cx->real_ids) free(cx->real_ids);
> - if (cx->real_vids) free(cx->real_vids);
> + free(cx->feedbackBuf);
> + free(cx->selectBuf);
> + free(cx->real_ids);
> + free(cx->real_vids);
>
> if (cx->pGlxPixmap) {
> /*
> --
> 1.7.2.3
Man, more of these?
Reviewed-by: Matt Turner <mattst88 at gmail.com>
More information about the xorg-devel
mailing list