mi: fix memory leak in miInitVisuals
Free the pointers inside miInitVisuals, so the callers of this function (fboverlay.c and fbscreen.c) don't need to worry with deallocation in the case of failure. Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
8ab92cd982
commit
dce2f10cf7
|
@ -221,11 +221,7 @@ fbFinishScreenInit(ScreenPtr pScreen,
|
|||
rootdepth = 0;
|
||||
if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
|
||||
&defaultVisual,((unsigned long)1<<(imagebpp-1)), 8))
|
||||
{
|
||||
free(visuals);
|
||||
free(depths);
|
||||
return FALSE;
|
||||
}
|
||||
if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
|
||||
rootdepth, ndepths, depths,
|
||||
defaultVisual, nvisuals, visuals))
|
||||
|
|
|
@ -564,6 +564,8 @@ miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
|
|||
{
|
||||
vid = malloc(nvtype * sizeof (VisualID));
|
||||
if (!vid) {
|
||||
free(depth);
|
||||
free(visual);
|
||||
free(preferredCVCs);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user