From 7e975e3ccff9aa809c1fec7b2642615f2a934c10 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 18 Nov 2017 23:33:53 +0100 Subject: simply free() calls free() can handle NULL so there's no need to check this ourselves --- nx-X11/programs/Xserver/hw/nxagent/Font.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/Font.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Font.c b/nx-X11/programs/Xserver/hw/nxagent/Font.c index f9c682765..3b35a8bff 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Font.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Font.c @@ -841,10 +841,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP for (j = 0; j < numSearchFields; j++) { - if (searchFields[j] != NULL) - { - free(searchFields[j]); - } + free(searchFields[j]); } } } @@ -863,10 +860,7 @@ static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontP for (j = 0; j < numFontFields; j++) { - if (fontNameFields[j] != NULL) - { - free(fontNameFields[j]); - } + free(fontNameFields[j]); } return fontStruct; @@ -1260,17 +1254,11 @@ static void nxagentFailedFontReconnect(FontPtr pFont, XID param1, void * param2) static void nxagentFreeFailedToReconnectFonts() { - if (nxagentFailedToReconnectFonts.font != NULL) - { - free(nxagentFailedToReconnectFonts.font); - nxagentFailedToReconnectFonts.font = NULL; - } + free(nxagentFailedToReconnectFonts.font); + nxagentFailedToReconnectFonts.font = NULL; - if (nxagentFailedToReconnectFonts.id != NULL) - { - free(nxagentFailedToReconnectFonts.id); - nxagentFailedToReconnectFonts.id = NULL; - } + free(nxagentFailedToReconnectFonts.id); + nxagentFailedToReconnectFonts.id = NULL; nxagentFailedToReconnectFonts.size = 0; nxagentFailedToReconnectFonts.index = 0; @@ -1706,10 +1694,7 @@ int nxagentFreeFont(XFontStruct *fs) #endif } - if (fs -> properties) - { - free (fs->properties); - } + free (fs->properties); XFree(fs); -- cgit v1.2.3