From 7482afcaa71df7ed60909c3c3f995f4723190d4e Mon Sep 17 00:00:00 2001 From: Ander Conselvan de Oliveira Date: Tue, 1 Feb 2011 11:07:25 +0200 Subject: xcms/LRGB: Add a label for freeing property_return. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The rest of the code uses goto's to free memory allocated later and prevent memory leaks, but there were several paths were property_return was free'd just before a goto. Reviewed-by: Alan Coopersmith Signed-off-by: Ander Conselvan de Oliveira Signed-off-by: Erkki Seppälä Signed-off-by: Alan Coopersmith Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/LRGB.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'nx-X11/lib/X11/LRGB.c') diff --git a/nx-X11/lib/X11/LRGB.c b/nx-X11/lib/X11/LRGB.c index 534a7307e..f2027ea3f 100644 --- a/nx-X11/lib/X11/LRGB.c +++ b/nx-X11/lib/X11/LRGB.c @@ -595,8 +595,7 @@ LINEAR_RGB_InitSCCData( * intensity2 */ if (nitems < 9) { - Xfree ((char *)property_return); - goto FreeSCCData; + goto Free_property_return; } count = 3; break; @@ -612,8 +611,7 @@ LINEAR_RGB_InitSCCData( * intensity2 */ if (nitems < 7) { - Xfree ((char *)property_return); - goto FreeSCCData; + goto Free_property_return; } count = 1; break; @@ -628,14 +626,12 @@ LINEAR_RGB_InitSCCData( * intensity2 */ if (nitems < 6) { - Xfree ((char *)property_return); - goto FreeSCCData; + goto Free_property_return; } count = 0; break; default: - Xfree ((char *)property_return); - goto FreeSCCData; + goto Free_property_return; } /* @@ -687,8 +683,7 @@ LINEAR_RGB_InitSCCData( /* Red Intensity Table */ if (!(pScreenData->pRedTbl = (IntensityTbl *) Xcalloc (1, sizeof(IntensityTbl)))) { - XFree ((char * ) property_return); - goto FreeSCCData; + goto Free_property_return; } if (_XcmsGetTableType0(pScreenData->pRedTbl, format_return, &pChar, &nitems) == XcmsFailure) { @@ -725,8 +720,7 @@ LINEAR_RGB_InitSCCData( /* Red Intensity Table */ if (!(pScreenData->pRedTbl = (IntensityTbl *) Xcalloc (1, sizeof(IntensityTbl)))) { - XFree ((char * ) property_return); - goto FreeSCCData; + goto Free_property_return; } if (_XcmsGetTableType1(pScreenData->pRedTbl, format_return, &pChar, &nitems) == XcmsFailure) { @@ -763,8 +757,7 @@ LINEAR_RGB_InitSCCData( } } } else { - Xfree ((char *)property_return); - goto FreeSCCData; + goto Free_property_return; } #ifdef ALLDEBUG @@ -821,6 +814,9 @@ FreeRedTblElements: FreeRedTbl: Xfree((char *)pScreenData->pRedTbl); +Free_property_return: + Xfree ((char *)property_return); + FreeSCCData: Xfree((char *)pScreenData); pPerScrnInfo->state = XcmsInitNone; -- cgit v1.2.3