summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>2011-03-30 15:06:10 +0300
committerAnder Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>2011-04-13 11:06:00 +0300
commit7c362e275c93c92b4e68fe862e73ee36665de703 (patch)
tree55ad2eab5a7195d9d3bf51e1bf8abbad60f87a64
parent5c810e2ac233e00f361549bafb9b59e8a9e05eff (diff)
xcms: Fix memory leaks on LINEAR_RGB_InitSCCData error path.
pScreenData is replaced when building per visual intensity tables. If malloc failed the old value of pScreenData (stored also in pScreenDefaultData) was being leaked. Also, property_return wasn't free'd in that case. Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/xcms/LRGB.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/xcms/LRGB.c b/src/xcms/LRGB.c
index 9b394fe8..5ecb7d12 100644
--- a/src/xcms/LRGB.c
+++ b/src/xcms/LRGB.c
@@ -653,7 +653,7 @@ LINEAR_RGB_InitSCCData(
*/
if (!(pScreenData = (LINEAR_RGB_SCCData *)
Xcalloc (1, sizeof(LINEAR_RGB_SCCData)))) {
- return(XcmsFailure);
+ goto Free_property_return;
}
/* copy matrices */
memcpy((char *)pScreenData, (char *)pScreenDefaultData,
@@ -663,7 +663,7 @@ LINEAR_RGB_InitSCCData(
if (!(pNewMap = (XcmsIntensityMap *)
Xcalloc (1, sizeof(XcmsIntensityMap)))) {
Xfree((char *)pScreenData);
- return(XcmsFailure);
+ goto Free_property_return;
}
pNewMap->visualID = visualID;
pNewMap->screenData = (XPointer)pScreenData;
@@ -817,7 +817,7 @@ Free_property_return:
Xfree ((char *)property_return);
FreeSCCData:
- Xfree((char *)pScreenData);
+ Xfree((char *)pScreenDefaultData);
pPerScrnInfo->state = XcmsInitNone;
return(XcmsFailure);
}