mirror of
https://gitlab.freedesktop.org/xorg/lib/libx11.git
synced 2026-05-07 13:18:04 +02:00
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>
This commit is contained in:
parent
5c810e2ac2
commit
7c362e275c
1 changed files with 3 additions and 3 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue