[PATCH 2/5] xext: don't free uninitialised pointer when malloc fails.

Dave Airlie airlied at gmail.com
Wed Oct 19 09:01:44 PDT 2011


From: Dave Airlie <airlied at redhat.com>

Initialise the pAttr->values to NULL so if the values allocation
fails it just ends up as free(NULL).

Pointed out by coverity.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 Xext/saver.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Xext/saver.c b/Xext/saver.c
index 142758c..c6bcafa 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -925,6 +925,7 @@ ScreenSaverSetAttributes (ClientPtr client)
 	goto bail;
     }
     /* over allocate for override redirect */
+    pAttr->values = NULL;
     values = malloc((len + 1) * sizeof (unsigned long));
     if (!values)
     {
-- 
1.7.6.4



More information about the xorg-devel mailing list