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,
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;
}
}
......
......@@ -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 ;
}
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -191,10 +191,8 @@ sparcPromClose(void)
close(promFd);
promFd = -1;
}
if (promOpio) {
free(promOpio);
promOpio = NULL;
}
free(promOpio);
promOpio = NULL;
promOpenCount = 0;
}
......
......@@ -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 ();
......
......@@ -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;
}
......
......@@ -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));
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
......
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