From 0a4d8cbdcd7b25313fb29ccdb498044af95f7de6 Mon Sep 17 00:00:00 2001 From: Mikhail Gusarov Date: Sun, 6 Jun 2010 15:28:30 +0700 Subject: Remove more superfluous if(p) checks around free(p) This patch has been generated by the following Coccinelle semantic patch: @@ expression E; @@ -if(E) { free(E); } +free(E); Signed-off-by: Mikhail Gusarov Reviewed-by: Julien Cristau Reviewed-by: Fernando Carrijo Reviewed-by: Matt Turner --- glx/glxcmds.c | 3 +-- glx/glxext.c | 12 ++++++------ glx/single2.c | 6 ++---- glx/xfont.c | 4 +--- 4 files changed, 10 insertions(+), 15 deletions(-) (limited to 'glx') diff --git a/glx/glxcmds.c b/glx/glxcmds.c index 25346f923..1d3be4921 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -2431,8 +2431,7 @@ int __glXDisp_ClientInfo(__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 = xstrdup(buf); diff --git a/glx/glxext.c b/glx/glxext.c index 4d02b4778..e203156e4 100644 --- a/glx/glxext.c +++ b/glx/glxext.c @@ -205,8 +205,8 @@ GLboolean __glXFreeContext(__GLXcontext *cx) { if (cx->idExists || cx->isCurrent) return GL_FALSE; - if (cx->feedbackBuf) free(cx->feedbackBuf); - if (cx->selectBuf) free(cx->selectBuf); + free(cx->feedbackBuf); + free(cx->selectBuf); if (cx == __glXLastContext) { __glXFlushContextCache(); } @@ -323,10 +323,10 @@ glxClientCallback (CallbackListPtr *list, } } - if (cl->returnBuf) free(cl->returnBuf); - if (cl->largeCmdBuf) free(cl->largeCmdBuf); - if (cl->currentContexts) free(cl->currentContexts); - if (cl->GLClientextensions) free(cl->GLClientextensions); + free(cl->returnBuf); + free(cl->largeCmdBuf); + free(cl->currentContexts); + free(cl->GLClientextensions); break; default: diff --git a/glx/single2.c b/glx/single2.c index 070062691..56ad86dc6 100644 --- a/glx/single2.c +++ b/glx/single2.c @@ -272,10 +272,8 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string) s2 = sext_string; } if (!combo_string || !s1) { - if (combo_string) - free(combo_string); - if (s1) - free(s1); + free(combo_string); + free(s1); return NULL; } combo_string[0] = '\0'; diff --git a/glx/xfont.c b/glx/xfont.c index f0b5644b9..b4081cfd4 100644 --- a/glx/xfont.c +++ b/glx/xfont.c @@ -97,9 +97,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci) pci->metrics.characterWidth, 0, allocbuf ? allocbuf : buf) ); - if (allocbuf) { - free(allocbuf); - } + free(allocbuf); return Success; #undef __GL_CHAR_BUF_SIZE } -- cgit v1.2.3