[PATCH 02/10] xfree86: NULL option values are technically valid, don't strdup them

Peter Hutterer peter.hutterer at who-t.net
Sun Jul 3 23:09:08 PDT 2011


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 hw/xfree86/common/xf86Option.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index 480f386..a3a836f 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -340,7 +340,7 @@ pointer
 xf86AddNewOption(pointer head, const char *name, const char *val)
 {
     /* XXX These should actually be allocated in the parser library. */
-    char *tmp = strdup(val);
+    char *tmp = val ? strdup(val) : NULL;
     char *tmp_name = strdup(name);
 
     return xf86addNewOption(head, tmp_name, tmp);
-- 
1.7.5.4



More information about the xorg-devel mailing list