xnest: fix segfault in miCreateScreenResources()
Withaa3f5023e3
, pScreen->devPrivate now is initialized only once, which uncovered a silent bug in xnestOpenScreen: It's NULL'ing the pScreen->devPrivate pointer which already had been initialized by previous miScreenDevPrivateInit() call. Fixes:aa3f5023e3
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1495>
This commit is contained in:
parent
86d0f6dafa
commit
94451181c2
|
@ -20,6 +20,8 @@ is" without express or implied warranty.
|
||||||
#include <X11/Xdefs.h>
|
#include <X11/Xdefs.h>
|
||||||
#include <X11/Xproto.h>
|
#include <X11/Xproto.h>
|
||||||
|
|
||||||
|
#include "mi/mi_priv.h"
|
||||||
|
|
||||||
#include "scrnintstr.h"
|
#include "scrnintstr.h"
|
||||||
#include "dix.h"
|
#include "dix.h"
|
||||||
#include "mi.h"
|
#include "mi.h"
|
||||||
|
@ -257,7 +259,6 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
||||||
pScreen->blackPixel = xnestBlackPixel;
|
pScreen->blackPixel = xnestBlackPixel;
|
||||||
/* GCperDepth */
|
/* GCperDepth */
|
||||||
/* defaultStipple */
|
/* defaultStipple */
|
||||||
pScreen->devPrivate = NULL;
|
|
||||||
/* WindowPrivateLen */
|
/* WindowPrivateLen */
|
||||||
/* WindowPrivateSizes */
|
/* WindowPrivateSizes */
|
||||||
/* totalWindowSize */
|
/* totalWindowSize */
|
||||||
|
@ -419,7 +420,7 @@ xnestCloseScreen(ScreenPtr pScreen)
|
||||||
free(pScreen->allowedDepths[i].vids);
|
free(pScreen->allowedDepths[i].vids);
|
||||||
free(pScreen->allowedDepths);
|
free(pScreen->allowedDepths);
|
||||||
free(pScreen->visuals);
|
free(pScreen->visuals);
|
||||||
free(pScreen->devPrivate);
|
miScreenClose(pScreen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If xnestDoFullGeneration all x resources will be destroyed upon closing
|
If xnestDoFullGeneration all x resources will be destroyed upon closing
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
/* SPDX-License-Identifier: MIT OR X11
|
||||||
|
*
|
||||||
|
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
|
||||||
|
*/
|
||||||
|
#ifndef _XSERVER_MI_PRIV_H
|
||||||
|
#define _XSERVER_MI_PRIV_H
|
||||||
|
|
||||||
|
#include "screenint.h"
|
||||||
|
|
||||||
|
void miScreenClose(ScreenPtr pScreen);
|
||||||
|
|
||||||
|
#endif /* _XSERVER_MI_PRIV_H */
|
|
@ -31,6 +31,9 @@ from The Open Group.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
|
|
||||||
|
#include "mi/mi_priv.h"
|
||||||
|
|
||||||
#include "servermd.h"
|
#include "servermd.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "mi.h"
|
#include "mi.h"
|
||||||
|
@ -309,3 +312,11 @@ miSetZeroLineBias(ScreenPtr pScreen, unsigned int bias)
|
||||||
dixSetPrivate(&pScreen->devPrivates, miZeroLineScreenKey,
|
dixSetPrivate(&pScreen->devPrivates, miZeroLineScreenKey,
|
||||||
(unsigned long *) (unsigned long) bias);
|
(unsigned long *) (unsigned long) bias);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void miScreenClose(ScreenPtr pScreen)
|
||||||
|
{
|
||||||
|
if (pScreen->devPrivate) {
|
||||||
|
free(pScreen->devPrivate);
|
||||||
|
pScreen->devPrivate = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue