summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorErkki Seppälä <erkki.seppala@vincit.fi>2011-03-08 13:29:41 -0500
committerAdam Jackson <ajax@redhat.com>2011-03-08 13:34:33 -0500
commita19771e4337d1c4600550314bbc42a1495a023ff (patch)
treef250d5b5ba6f31a40da152c84fef67256c317e9f /hw
parentb73ebe65cd071a063417ac9c38513a6742e32428 (diff)
xfree86/common: Remove a configScreen leak when conf_screen is NULL
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. [ajax: minor grammar fix] Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi> Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi>
Diffstat (limited to 'hw')
-rw-r--r--hw/xfree86/common/xf86Config.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 9602e899f..5312ca60d 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1787,9 +1787,11 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
XF86ConfDisplayPtr dispptr;
XF86ConfAdaptorLinkPtr conf_adaptor;
Bool defaultMonitor = FALSE;
+ XF86ConfScreenRec local_conf_screen;
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");
}