diff options
author | Matt Turner <mattst88@gmail.com> | 2010-06-10 04:08:54 +0700 |
---|---|---|
committer | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-06-11 19:05:46 +0700 |
commit | f4190feb25ecc3d8278decc8bf28a5ef0e568942 (patch) | |
tree | 1bda33d8d65126f4a7d2a53f6efdb69e4a426e1d /xkb | |
parent | 89bd05106e5823fc5cfca9abf082729f2444363b (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>
Diffstat (limited to 'xkb')
-rw-r--r-- | xkb/XKBGAlloc.c | 18 | ||||
-rw-r--r-- | xkb/XKBMAlloc.c | 18 | ||||
-rw-r--r-- | xkb/ddxList.c | 5 | ||||
-rw-r--r-- | xkb/xkb.c | 21 | ||||
-rw-r--r-- | xkb/xkbInit.c | 6 |
5 files changed, 27 insertions, 41 deletions
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; @@ -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; |