Skip to content

Commit

Permalink
xfree86/common: Remove a configScreen leak when conf_screen is NULL
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Rami Ylimäki <[email protected]>
Signed-off-by: Erkki Seppälä <[email protected]>
  • Loading branch information
eras authored and nwnk committed Mar 8, 2011
1 parent b73ebe6 commit a19771e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hw/xfree86/common/xf86Config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit a19771e

Please sign in to comment.