On 02/ 1/11 01:07 AM, Ander Conselvan de Oliveira wrote: > 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. > > Signed-off-by: Ander Conselvan de Oliveira > <[email protected]> > Signed-off-by: Erkki Seppälä <[email protected]> > --- > src/xcms/LRGB.c | 24 ++++++++++-------------- > 1 files changed, 10 insertions(+), 14 deletions(-) > > diff --git a/src/xcms/LRGB.c b/src/xcms/LRGB.c > index c1606be..2dca82e 100644 > --- a/src/xcms/LRGB.c > +++ b/src/xcms/LRGB.c > @@ -594,8 +594,7 @@ LINEAR_RGB_InitSCCData( > * intensity2 > */ > if (nitems < 9) { > - Xfree ((char *)property_return); > - goto FreeSCCData; > + goto Free_property_return; > } > count = 3; > break; > @@ -611,8 +610,7 @@ LINEAR_RGB_InitSCCData( > * intensity2 > */ > if (nitems < 7) { > - Xfree ((char *)property_return); > - goto FreeSCCData; > + goto Free_property_return; > } > count = 1; > break; > @@ -627,14 +625,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; > } > > /* > @@ -686,8 +682,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) { > @@ -724,8 +719,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) { > @@ -762,8 +756,7 @@ LINEAR_RGB_InitSCCData( > } > } > } else { > - Xfree ((char *)property_return); > - goto FreeSCCData; > + goto Free_property_return; > } > > #ifdef ALLDEBUG > @@ -820,6 +813,9 @@ FreeRedTblElements: > FreeRedTbl: > Xfree((char *)pScreenData->pRedTbl); > > +Free_property_return: > + Xfree ((char *)property_return); > + > FreeSCCData: > Xfree((char *)pScreenData); > pPerScrnInfo->state = XcmsInitNone;
Reviewed-by: Alan Coopersmith <[email protected]> -- -Alan Coopersmith- [email protected] Oracle Solaris Platform Engineering: X Window System _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
