summaryrefslogtreecommitdiff
path: root/xkb/XKBMAlloc.c
diff options
context:
space:
mode:
authorMikhail Gusarov <dottedmag@dottedmag.net>2010-06-06 15:28:30 +0700
committerMikhail Gusarov <dottedmag@dottedmag.net>2010-06-06 20:27:18 +0700
commit0a4d8cbdcd7b25313fb29ccdb498044af95f7de6 (patch)
tree3534c9035180b7e0d2ebbbf0202a370cb61f8e8d /xkb/XKBMAlloc.c
parent5a0fc0ad21d562612676ef88ef2d533b2391810a (diff)
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 <dottedmag@dottedmag.net> Reviewed-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Fernando Carrijo <fcarrijo@yahoo.com.br> Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'xkb/XKBMAlloc.c')
-rw-r--r--xkb/XKBMAlloc.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c
index abe001856..197523f57 100644
--- a/xkb/XKBMAlloc.c
+++ b/xkb/XKBMAlloc.c
@@ -312,8 +312,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
if ((map_count>type->map_count)||(type->map==NULL))
type->map = realloc(type->map,map_count * sizeof(XkbKTMapEntryRec));
if (!type->map) {
- if (prev_map)
- free(prev_map);
+ free(prev_map);
return BadAlloc;
}
if (want_preserve) {
@@ -324,8 +323,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
map_count * sizeof(XkbModsRec));
}
if (!type->preserve) {
- if (prev_preserve)
- free(prev_preserve);
+ free(prev_preserve);
return BadAlloc;
}
}
@@ -342,8 +340,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
type->level_names = realloc(type->level_names,
new_num_lvls * sizeof(Atom));
if (!type->level_names) {
- if (prev_level_names)
- free(prev_level_names);
+ free(prev_level_names);
return BadAlloc;
}
}