mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-02-08 08:00:30 +01:00
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
2 changed files with 2 additions and 4 deletions
|
|
@ -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…
Add table
Reference in a new issue