Commit 7482afca authored by Ander Conselvan de Oliveira's avatar Ander Conselvan de Oliveira Committed by Ulrich Sibiller

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: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: 's avatarAnder Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com> Signed-off-by: 's avatarErkki Seppälä <erkki.seppala@vincit.fi> Signed-off-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent 8f5a5647
...@@ -595,8 +595,7 @@ LINEAR_RGB_InitSCCData( ...@@ -595,8 +595,7 @@ LINEAR_RGB_InitSCCData(
* intensity2 * intensity2
*/ */
if (nitems < 9) { if (nitems < 9) {
Xfree ((char *)property_return); goto Free_property_return;
goto FreeSCCData;
} }
count = 3; count = 3;
break; break;
...@@ -612,8 +611,7 @@ LINEAR_RGB_InitSCCData( ...@@ -612,8 +611,7 @@ LINEAR_RGB_InitSCCData(
* intensity2 * intensity2
*/ */
if (nitems < 7) { if (nitems < 7) {
Xfree ((char *)property_return); goto Free_property_return;
goto FreeSCCData;
} }
count = 1; count = 1;
break; break;
...@@ -628,14 +626,12 @@ LINEAR_RGB_InitSCCData( ...@@ -628,14 +626,12 @@ LINEAR_RGB_InitSCCData(
* intensity2 * intensity2
*/ */
if (nitems < 6) { if (nitems < 6) {
Xfree ((char *)property_return); goto Free_property_return;
goto FreeSCCData;
} }
count = 0; count = 0;
break; break;
default: default:
Xfree ((char *)property_return); goto Free_property_return;
goto FreeSCCData;
} }
/* /*
...@@ -687,8 +683,7 @@ LINEAR_RGB_InitSCCData( ...@@ -687,8 +683,7 @@ LINEAR_RGB_InitSCCData(
/* Red Intensity Table */ /* Red Intensity Table */
if (!(pScreenData->pRedTbl = (IntensityTbl *) if (!(pScreenData->pRedTbl = (IntensityTbl *)
Xcalloc (1, sizeof(IntensityTbl)))) { Xcalloc (1, sizeof(IntensityTbl)))) {
XFree ((char * ) property_return); goto Free_property_return;
goto FreeSCCData;
} }
if (_XcmsGetTableType0(pScreenData->pRedTbl, format_return, &pChar, if (_XcmsGetTableType0(pScreenData->pRedTbl, format_return, &pChar,
&nitems) == XcmsFailure) { &nitems) == XcmsFailure) {
...@@ -725,8 +720,7 @@ LINEAR_RGB_InitSCCData( ...@@ -725,8 +720,7 @@ LINEAR_RGB_InitSCCData(
/* Red Intensity Table */ /* Red Intensity Table */
if (!(pScreenData->pRedTbl = (IntensityTbl *) if (!(pScreenData->pRedTbl = (IntensityTbl *)
Xcalloc (1, sizeof(IntensityTbl)))) { Xcalloc (1, sizeof(IntensityTbl)))) {
XFree ((char * ) property_return); goto Free_property_return;
goto FreeSCCData;
} }
if (_XcmsGetTableType1(pScreenData->pRedTbl, format_return, &pChar, if (_XcmsGetTableType1(pScreenData->pRedTbl, format_return, &pChar,
&nitems) == XcmsFailure) { &nitems) == XcmsFailure) {
...@@ -763,8 +757,7 @@ LINEAR_RGB_InitSCCData( ...@@ -763,8 +757,7 @@ LINEAR_RGB_InitSCCData(
} }
} }
} else { } else {
Xfree ((char *)property_return); goto Free_property_return;
goto FreeSCCData;
} }
#ifdef ALLDEBUG #ifdef ALLDEBUG
...@@ -821,6 +814,9 @@ FreeRedTblElements: ...@@ -821,6 +814,9 @@ FreeRedTblElements:
FreeRedTbl: FreeRedTbl:
Xfree((char *)pScreenData->pRedTbl); Xfree((char *)pScreenData->pRedTbl);
Free_property_return:
Xfree ((char *)property_return);
FreeSCCData: FreeSCCData:
Xfree((char *)pScreenData); Xfree((char *)pScreenData);
pPerScrnInfo->state = XcmsInitNone; pPerScrnInfo->state = XcmsInitNone;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment