summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>2011-02-01 11:07:25 +0200
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-02-01 23:46:25 -0800
commit85e9f38e016137f0ff2791eb0d092ab027382d2c (patch)
tree4d87da24f84a967d5cf4ac3942a8ed5d3fda2372
parent3161dc57d4e9b70f852f05e5e474455e121b06ab (diff)
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>
-rw-r--r--src/xcms/LRGB.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/xcms/LRGB.c b/src/xcms/LRGB.c
index 77fac367..750c4924 100644
--- a/src/xcms/LRGB.c
+++ b/src/xcms/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;