From af4a0a752c169b2c003978c550d57602af3fbe01 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 14 May 2010 20:15:18 -0700 Subject: Don't need to check if pointer is NULL before calling free() Signed-off-by: Alan Coopersmith Reviewed-by: Jamey Sharp --- src/encparse.c | 12 +++++------- src/fontenc.c | 9 +++------ 2 files changed, 8 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/encparse.c b/src/encparse.c index 33e0a05..5b4cefb 100644 --- a/src/encparse.c +++ b/src/encparse.c @@ -745,20 +745,19 @@ error: if(encsize) free(enc); encsize=0; if(namsize) { for(i = first; i <= last; i++) - if(nam[i]) - free(nam[i]); + free(nam[i]); free(nam); namsize = 0; } if(mapping) { - if(mapping->client_data) free(mapping->client_data); + free(mapping->client_data); free(mapping); } if(encoding) { FontMapPtr nextmap; - if (encoding->name) free(encoding->name); + free(encoding->name); for (mapping = encoding->mappings; mapping; mapping = nextmap) { - if (mapping->client_data) free(mapping->client_data); + free(mapping->client_data); nextmap = mapping->next; free(mapping); } @@ -930,8 +929,7 @@ FontEncIdentify(const char *fileName) names = malloc((numaliases+2)*sizeof(char*)); if(names == NULL) { - if(encoding->aliases) - free(encoding->aliases); + free(encoding->aliases); free(encoding); return NULL; } diff --git a/src/fontenc.c b/src/fontenc.c index 8718eff..86f5952 100644 --- a/src/fontenc.c +++ b/src/fontenc.c @@ -913,10 +913,8 @@ FontMapReverse(FontMapPtr mapping) return reverse; bail: - if(map) - free(map); - if(reverse) - free(reverse); + free(map); + free(reverse); return NULL; } @@ -930,8 +928,7 @@ FontMapReverseFree(FontMapReversePtr delendum) return; for(i = 0; i < FONTENC_SEGMENTS; i++) - if(map[i] != NULL) - free(map[i]); + free(map[i]); free(map); return; -- cgit v1.2.3