mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-08 07:58:03 +02: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
a071e92448
commit
c072663f37
2 changed files with 2 additions and 4 deletions
|
|
@ -225,11 +225,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