aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>2011-02-01 11:07:25 +0200
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:24 +0200
commit7482afcaa71df7ed60909c3c3f995f4723190d4e (patch)
treecb59edbf57a8d7f12d733a6c8492cb20d1e3b4a1 /nx-X11/lib
parent8f5a56474671bf3dd4909aa73fec1062fb5a14d8 (diff)
downloadnx-libs-7482afcaa71df7ed60909c3c3f995f4723190d4e.tar.gz
nx-libs-7482afcaa71df7ed60909c3c3f995f4723190d4e.tar.bz2
nx-libs-7482afcaa71df7ed60909c3c3f995f4723190d4e.zip
xcms/LRGB: Add a label for freeing property_return.
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 <alan.coopersmith@oracle.com> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com> Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11/lib')
-rw-r--r--nx-X11/lib/X11/LRGB.c24
1 files changed, 10 insertions, 14 deletions
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;