[PATCH] xfree86/common: Removed a configScreen leak when conf_screen is NULL
Erkki Seppälä
erkki.seppala at vincit.fi
Tue Mar 8 03:10:48 PST 2011
configScreen used a dynamically allocated buffer for XF86ConfScreenRec
when conf_screen argument was NULL. This pointer was never stored
anywhere, nor was it released, so this patch makes the function use
automatically allocated storage in that situation.
Reviewed-by: Rami Ylimäki <rami.ylimaki at vincit.fi>
Signed-off-by: Erkki Seppälä <erkki.seppala at vincit.fi>
---
hw/xfree86/common/xf86Config.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 28786ba..906d4bd 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1829,9 +1829,11 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
XF86ConfDisplayPtr dispptr;
XF86ConfAdaptorLinkPtr conf_adaptor;
Bool defaultMonitor = FALSE;
+ XF86ConfScreenRec local_conf_screen; /* used only if conf_screen is NULL */
if (!conf_screen) {
- conf_screen = xnfcalloc(1, sizeof(XF86ConfScreenRec));
+ memset(&local_conf_screen, 0, sizeof(local_conf_screen));
+ conf_screen = &local_conf_screen;
conf_screen->scrn_identifier = "Default Screen Section";
xf86Msg(X_DEFAULT, "No screen section available. Using defaults.\n");
}
--
1.7.0.4
More information about the xorg-devel
mailing list