summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2010-06-10 04:08:54 +0700
committerMikhail Gusarov <dottedmag@dottedmag.net>2010-06-11 19:05:46 +0700
commitf4190feb25ecc3d8278decc8bf28a5ef0e568942 (patch)
tree1bda33d8d65126f4a7d2a53f6efdb69e4a426e1d
parent89bd05106e5823fc5cfca9abf082729f2444363b (diff)
Remove more superfluous if(p) checks around free(p)
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
-rw-r--r--exa/exa_glyphs.c12
-rw-r--r--hw/kdrive/ephyr/ephyrhostvideo.c6
-rw-r--r--hw/kdrive/ephyr/hostx.c25
-rw-r--r--hw/xfree86/modes/xf86Cursors.c7
-rw-r--r--hw/xfree86/os-support/bus/Sbus.c6
-rw-r--r--hw/xwin/InitOutput.c7
-rw-r--r--xkb/XKBGAlloc.c18
-rw-r--r--xkb/XKBMAlloc.c18
-rw-r--r--xkb/ddxList.c5
-rw-r--r--xkb/xkb.c21
-rw-r--r--xkb/xkbInit.c6
11 files changed, 47 insertions, 84 deletions
diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
index b09db46b0..5c46ec901 100644
--- a/exa/exa_glyphs.c
+++ b/exa/exa_glyphs.c
@@ -127,15 +127,11 @@ exaUnrealizeGlyphCaches(ScreenPtr pScreen,
cache->picture = NULL;
}
- if (cache->hashEntries) {
- free(cache->hashEntries);
- cache->hashEntries = NULL;
- }
+ free(cache->hashEntries);
+ cache->hashEntries = NULL;
- if (cache->glyphs) {
- free(cache->glyphs);
- cache->glyphs = NULL;
- }
+ free(cache->glyphs);
+ cache->glyphs = NULL;
cache->glyphCount = 0;
}
}
diff --git a/hw/kdrive/ephyr/ephyrhostvideo.c b/hw/kdrive/ephyr/ephyrhostvideo.c
index 38927b02d..9dde768c8 100644
--- a/hw/kdrive/ephyr/ephyrhostvideo.c
+++ b/hw/kdrive/ephyr/ephyrhostvideo.c
@@ -831,10 +831,8 @@ out:
XFreeGC (dpy, gc) ;
gc = NULL ;
}
- if (rects) {
- free (rects) ;
- rects = NULL ;
- }
+ free(rects);
+ rects = NULL;
EPHYR_LOG ("leave\n") ;
return is_ok ;
}
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 38ee06d25..2ebeca958 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -669,11 +669,8 @@ hostx_screen_init (EphyrScreenInfo screen,
}
else
{
- if (host_screen->ximg->data)
- {
- free(host_screen->ximg->data);
- host_screen->ximg->data = NULL;
- }
+ free(host_screen->ximg->data);
+ host_screen->ximg->data = NULL;
XDestroyImage(host_screen->ximg);
}
@@ -1160,10 +1157,8 @@ out:
XFree (visuals) ;
visuals = NULL;
}
- if (host_visuals) {
- free (host_visuals) ;
- host_visuals = NULL;
- }
+ free(host_visuals);
+ host_visuals = NULL;
EPHYR_LOG ("leave\n") ;
return is_ok ;
@@ -1292,10 +1287,8 @@ hostx_set_window_bounding_rectangles (int a_window,
rects, a_num_rects, ShapeSet, YXBanded) ;
is_ok = TRUE ;
- if (rects) {
- free (rects) ;
- rects = NULL ;
- }
+ free(rects);
+ rects = NULL;
EPHYR_LOG ("leave\n") ;
return is_ok;
}
@@ -1329,10 +1322,8 @@ hostx_set_window_clipping_rectangles (int a_window,
rects, a_num_rects, ShapeSet, YXBanded) ;
is_ok = TRUE ;
- if (rects) {
- free (rects) ;
- rects = NULL ;
- }
+ free(rects);
+ rects = NULL;
EPHYR_LOG ("leave\n") ;
return is_ok;
}
diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index 5842a613c..038f1c89c 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -659,11 +659,8 @@ xf86_cursors_fini (ScreenPtr screen)
xf86DestroyCursorInfoRec (xf86_config->cursor_info);
xf86_config->cursor_info = NULL;
}
- if (xf86_config->cursor_image)
- {
- free(xf86_config->cursor_image);
- xf86_config->cursor_image = NULL;
- }
+ free(xf86_config->cursor_image);
+ xf86_config->cursor_image = NULL;
if (xf86_config->cursor)
{
FreeCursor (xf86_config->cursor, None);
diff --git a/hw/xfree86/os-support/bus/Sbus.c b/hw/xfree86/os-support/bus/Sbus.c
index 9ccc2898f..7829d803f 100644
--- a/hw/xfree86/os-support/bus/Sbus.c
+++ b/hw/xfree86/os-support/bus/Sbus.c
@@ -191,10 +191,8 @@ sparcPromClose(void)
close(promFd);
promFd = -1;
}
- if (promOpio) {
- free(promOpio);
- promOpio = NULL;
- }
+ free(promOpio);
+ promOpio = NULL;
promOpenCount = 0;
}
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 1b976061c..73cc263bd 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -275,11 +275,8 @@ ddxGiveUp (void)
}
/* Free concatenated command line */
- if (g_pszCommandLine)
- {
- free (g_pszCommandLine);
- g_pszCommandLine = NULL;
- }
+ free(g_pszCommandLine);
+ g_pszCommandLine = NULL;
/* Remove our keyboard hook if it is installed */
winRemoveKeyboardHookLL ();
diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c
index 796931cf4..d1adea34e 100644
--- a/xkb/XKBGAlloc.c
+++ b/xkb/XKBGAlloc.c
@@ -114,10 +114,8 @@ register char *ptr;
}
if (freeAll) {
(*num_inout)= (*sz_inout)= 0;
- if (*elems) {
- free(*elems);
- *elems= NULL;
- }
+ free(*elems);
+ *elems = NULL;
}
else if (first+count>=(*num_inout))
*num_inout= first;
@@ -137,14 +135,10 @@ _XkbClearProperty(char *prop_in)
{
XkbPropertyPtr prop= (XkbPropertyPtr)prop_in;
- if (prop->name) {
- free(prop->name);
- prop->name= NULL;
- }
- if (prop->value) {
- free(prop->value);
- prop->value= NULL;
- }
+ free(prop->name);
+ prop->name = NULL;
+ free(prop->value);
+ prop->value = NULL;
return;
}
diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c
index 197523f57..6b186c1ad 100644
--- a/xkb/XKBMAlloc.c
+++ b/xkb/XKBMAlloc.c
@@ -221,18 +221,12 @@ XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into)
{
if ((!from)||(!into))
return BadMatch;
- if (into->map) {
- free(into->map);
- into->map= NULL;
- }
- if (into->preserve) {
- free(into->preserve);
- into->preserve= NULL;
- }
- if (into->level_names) {
- free(into->level_names);
- into->level_names= NULL;
- }
+ free(into->map);
+ into->map = NULL;
+ free(into->preserve);
+ into->preserve = NULL;
+ free(into->level_names);
+ into->level_names = NULL;
*into= *from;
if ((from->map)&&(into->map_count>0)) {
into->map= calloc(into->map_count, sizeof(XkbKTMapEntryRec));
diff --git a/xkb/ddxList.c b/xkb/ddxList.c
index eee388749..2256424d0 100644
--- a/xkb/ddxList.c
+++ b/xkb/ddxList.c
@@ -208,10 +208,7 @@ char tmpname[PATH_MAX];
return BadImplementation;
}
list->nFound[what]= 0;
- if (buf) {
- free(buf);
- buf = NULL;
- }
+ free(buf);
buf = malloc(PATH_MAX * sizeof(char));
if (!buf)
return BadAlloc;
diff --git a/xkb/xkb.c b/xkb/xkb.c
index cbb46c62f..bd73e9a8e 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -5510,10 +5510,8 @@ ProcXkbListComponents(ClientPtr client)
if ((XkbPaddedSize(len)/4)!=stuff->length)
return BadLength;
if ((status=XkbDDXList(dev,&list,client))!=Success) {
- if (list.pool) {
- free(list.pool);
- list.pool= NULL;
- }
+ free(list.pool);
+ list.pool = NULL;
return status;
}
memset(&rep, 0, sizeof(xkbListComponentsReply));
@@ -5886,11 +5884,16 @@ ProcXkbGetKbdByName(ClientPtr client)
XkbFreeKeyboard(new,XkbAllComponentsMask,TRUE);
new= NULL;
}
- if (names.keycodes) { free(names.keycodes); names.keycodes= NULL; }
- if (names.types) { free(names.types); names.types= NULL; }
- if (names.compat) { free(names.compat); names.compat= NULL; }
- if (names.symbols) { free(names.symbols); names.symbols= NULL; }
- if (names.geometry) { free(names.geometry); names.geometry= NULL; }
+ free(names.keycodes);
+ names.keycodes = NULL;
+ free(names.types);
+ names.types = NULL;
+ free(names.compat);
+ names.compat = NULL;
+ free(names.symbols);
+ names.symbols = NULL;
+ free(names.geometry);
+ names.geometry = NULL;
return Success;
}
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index bd58243ca..fbf8f14b8 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -635,10 +635,8 @@ unwind_key:
void
XkbFreeInfo(XkbSrvInfoPtr xkbi)
{
- if (xkbi->radioGroups) {
- free(xkbi->radioGroups);
- xkbi->radioGroups= NULL;
- }
+ free(xkbi->radioGroups);
+ xkbi->radioGroups = NULL;
if (xkbi->mouseKeyTimer) {
TimerFree(xkbi->mouseKeyTimer);
xkbi->mouseKeyTimer= NULL;