Commit f4190feb authored by Matt Turner's avatar Matt Turner Committed by Mikhail Gusarov

Remove more superfluous if(p) checks around free(p)

Reviewed-by: Alan Coopersmith's avatarAlan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Matt Turner's avatarMatt Turner <mattst88@gmail.com>
Signed-off-by: Mikhail Gusarov's avatarMikhail Gusarov <dottedmag@dottedmag.net>
parent 89bd0510
...@@ -127,15 +127,11 @@ exaUnrealizeGlyphCaches(ScreenPtr pScreen, ...@@ -127,15 +127,11 @@ exaUnrealizeGlyphCaches(ScreenPtr pScreen,
cache->picture = NULL; cache->picture = NULL;
} }
if (cache->hashEntries) { free(cache->hashEntries);
free(cache->hashEntries); cache->hashEntries = NULL;
cache->hashEntries = NULL;
}
if (cache->glyphs) { free(cache->glyphs);
free(cache->glyphs); cache->glyphs = NULL;
cache->glyphs = NULL;
}
cache->glyphCount = 0; cache->glyphCount = 0;
} }
} }
......
...@@ -831,10 +831,8 @@ out: ...@@ -831,10 +831,8 @@ out:
XFreeGC (dpy, gc) ; XFreeGC (dpy, gc) ;
gc = NULL ; gc = NULL ;
} }
if (rects) { free(rects);
free (rects) ; rects = NULL;
rects = NULL ;
}
EPHYR_LOG ("leave\n") ; EPHYR_LOG ("leave\n") ;
return is_ok ; return is_ok ;
} }
......
...@@ -669,11 +669,8 @@ hostx_screen_init (EphyrScreenInfo screen, ...@@ -669,11 +669,8 @@ hostx_screen_init (EphyrScreenInfo screen,
} }
else 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); XDestroyImage(host_screen->ximg);
} }
...@@ -1160,10 +1157,8 @@ out: ...@@ -1160,10 +1157,8 @@ out:
XFree (visuals) ; XFree (visuals) ;
visuals = NULL; visuals = NULL;
} }
if (host_visuals) { free(host_visuals);
free (host_visuals) ; host_visuals = NULL;
host_visuals = NULL;
}
EPHYR_LOG ("leave\n") ; EPHYR_LOG ("leave\n") ;
return is_ok ; return is_ok ;
...@@ -1292,10 +1287,8 @@ hostx_set_window_bounding_rectangles (int a_window, ...@@ -1292,10 +1287,8 @@ hostx_set_window_bounding_rectangles (int a_window,
rects, a_num_rects, ShapeSet, YXBanded) ; rects, a_num_rects, ShapeSet, YXBanded) ;
is_ok = TRUE ; is_ok = TRUE ;
if (rects) { free(rects);
free (rects) ; rects = NULL;
rects = NULL ;
}
EPHYR_LOG ("leave\n") ; EPHYR_LOG ("leave\n") ;
return is_ok; return is_ok;
} }
...@@ -1329,10 +1322,8 @@ hostx_set_window_clipping_rectangles (int a_window, ...@@ -1329,10 +1322,8 @@ hostx_set_window_clipping_rectangles (int a_window,
rects, a_num_rects, ShapeSet, YXBanded) ; rects, a_num_rects, ShapeSet, YXBanded) ;
is_ok = TRUE ; is_ok = TRUE ;
if (rects) { free(rects);
free (rects) ; rects = NULL;
rects = NULL ;
}
EPHYR_LOG ("leave\n") ; EPHYR_LOG ("leave\n") ;
return is_ok; return is_ok;
} }
......
...@@ -659,11 +659,8 @@ xf86_cursors_fini (ScreenPtr screen) ...@@ -659,11 +659,8 @@ xf86_cursors_fini (ScreenPtr screen)
xf86DestroyCursorInfoRec (xf86_config->cursor_info); xf86DestroyCursorInfoRec (xf86_config->cursor_info);
xf86_config->cursor_info = NULL; 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) if (xf86_config->cursor)
{ {
FreeCursor (xf86_config->cursor, None); FreeCursor (xf86_config->cursor, None);
......
...@@ -191,10 +191,8 @@ sparcPromClose(void) ...@@ -191,10 +191,8 @@ sparcPromClose(void)
close(promFd); close(promFd);
promFd = -1; promFd = -1;
} }
if (promOpio) { free(promOpio);
free(promOpio); promOpio = NULL;
promOpio = NULL;
}
promOpenCount = 0; promOpenCount = 0;
} }
......
...@@ -275,11 +275,8 @@ ddxGiveUp (void) ...@@ -275,11 +275,8 @@ ddxGiveUp (void)
} }
/* Free concatenated command line */ /* 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 */ /* Remove our keyboard hook if it is installed */
winRemoveKeyboardHookLL (); winRemoveKeyboardHookLL ();
......
...@@ -114,10 +114,8 @@ register char *ptr; ...@@ -114,10 +114,8 @@ register char *ptr;
} }
if (freeAll) { if (freeAll) {
(*num_inout)= (*sz_inout)= 0; (*num_inout)= (*sz_inout)= 0;
if (*elems) { free(*elems);
free(*elems); *elems = NULL;
*elems= NULL;
}
} }
else if (first+count>=(*num_inout)) else if (first+count>=(*num_inout))
*num_inout= first; *num_inout= first;
...@@ -137,14 +135,10 @@ _XkbClearProperty(char *prop_in) ...@@ -137,14 +135,10 @@ _XkbClearProperty(char *prop_in)
{ {
XkbPropertyPtr prop= (XkbPropertyPtr)prop_in; XkbPropertyPtr prop= (XkbPropertyPtr)prop_in;
if (prop->name) { free(prop->name);
free(prop->name); prop->name = NULL;
prop->name= NULL; free(prop->value);
} prop->value = NULL;
if (prop->value) {
free(prop->value);
prop->value= NULL;
}
return; return;
} }
......
...@@ -221,18 +221,12 @@ XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into) ...@@ -221,18 +221,12 @@ XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into)
{ {
if ((!from)||(!into)) if ((!from)||(!into))
return BadMatch; return BadMatch;
if (into->map) { free(into->map);
free(into->map); into->map = NULL;
into->map= NULL; free(into->preserve);
} into->preserve = NULL;
if (into->preserve) { free(into->level_names);
free(into->preserve); into->level_names = NULL;
into->preserve= NULL;
}
if (into->level_names) {
free(into->level_names);
into->level_names= NULL;
}
*into= *from; *into= *from;
if ((from->map)&&(into->map_count>0)) { if ((from->map)&&(into->map_count>0)) {
into->map= calloc(into->map_count, sizeof(XkbKTMapEntryRec)); into->map= calloc(into->map_count, sizeof(XkbKTMapEntryRec));
......
...@@ -208,10 +208,7 @@ char tmpname[PATH_MAX]; ...@@ -208,10 +208,7 @@ char tmpname[PATH_MAX];
return BadImplementation; return BadImplementation;
} }
list->nFound[what]= 0; list->nFound[what]= 0;
if (buf) { free(buf);
free(buf);
buf = NULL;
}
buf = malloc(PATH_MAX * sizeof(char)); buf = malloc(PATH_MAX * sizeof(char));
if (!buf) if (!buf)
return BadAlloc; return BadAlloc;
......
...@@ -5510,10 +5510,8 @@ ProcXkbListComponents(ClientPtr client) ...@@ -5510,10 +5510,8 @@ ProcXkbListComponents(ClientPtr client)
if ((XkbPaddedSize(len)/4)!=stuff->length) if ((XkbPaddedSize(len)/4)!=stuff->length)
return BadLength; return BadLength;
if ((status=XkbDDXList(dev,&list,client))!=Success) { if ((status=XkbDDXList(dev,&list,client))!=Success) {
if (list.pool) { free(list.pool);
free(list.pool); list.pool = NULL;
list.pool= NULL;
}
return status; return status;
} }
memset(&rep, 0, sizeof(xkbListComponentsReply)); memset(&rep, 0, sizeof(xkbListComponentsReply));
...@@ -5886,11 +5884,16 @@ ProcXkbGetKbdByName(ClientPtr client) ...@@ -5886,11 +5884,16 @@ ProcXkbGetKbdByName(ClientPtr client)
XkbFreeKeyboard(new,XkbAllComponentsMask,TRUE); XkbFreeKeyboard(new,XkbAllComponentsMask,TRUE);
new= NULL; new= NULL;
} }
if (names.keycodes) { free(names.keycodes); names.keycodes= NULL; } free(names.keycodes);
if (names.types) { free(names.types); names.types= NULL; } names.keycodes = NULL;
if (names.compat) { free(names.compat); names.compat= NULL; } free(names.types);
if (names.symbols) { free(names.symbols); names.symbols= NULL; } names.types = NULL;
if (names.geometry) { free(names.geometry); names.geometry= NULL; } free(names.compat);
names.compat = NULL;
free(names.symbols);
names.symbols = NULL;
free(names.geometry);
names.geometry = NULL;
return Success; return Success;
} }
......
...@@ -635,10 +635,8 @@ unwind_key: ...@@ -635,10 +635,8 @@ unwind_key:
void void
XkbFreeInfo(XkbSrvInfoPtr xkbi) XkbFreeInfo(XkbSrvInfoPtr xkbi)
{ {
if (xkbi->radioGroups) { free(xkbi->radioGroups);
free(xkbi->radioGroups); xkbi->radioGroups = NULL;
xkbi->radioGroups= NULL;
}
if (xkbi->mouseKeyTimer) { if (xkbi->mouseKeyTimer) {
TimerFree(xkbi->mouseKeyTimer); TimerFree(xkbi->mouseKeyTimer);
xkbi->mouseKeyTimer= NULL; xkbi->mouseKeyTimer= NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment