summaryrefslogtreecommitdiff
path: root/hw/xfree86/parser/Flags.c
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2009-04-09 02:26:24 -0400
committerEamon Walsh <ewalsh@tycho.nsa.gov>2009-04-09 02:29:28 -0400
commit3a0ee199dcec39596756a995996eac388acf6315 (patch)
tree9d729273776f8ead280196ed29101a23a035e42e /hw/xfree86/parser/Flags.c
parent7b3982eb6518da33ab01c2fbf7ceb45b89f841df (diff)
config: fix crash caused by strdup(NULL)
Diffstat (limited to 'hw/xfree86/parser/Flags.c')
-rw-r--r--hw/xfree86/parser/Flags.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/xfree86/parser/Flags.c b/hw/xfree86/parser/Flags.c
index b4e8d2583..6865d3592 100644
--- a/hw/xfree86/parser/Flags.c
+++ b/hw/xfree86/parser/Flags.c
@@ -235,11 +235,12 @@ XF86OptionPtr
xf86optionListDup (XF86OptionPtr opt)
{
XF86OptionPtr newopt = NULL;
+ char *val;
while (opt)
{
- newopt = xf86addNewOption(newopt, strdup(opt->opt_name),
- strdup(opt->opt_val));
+ val = opt->opt_val ? strdup(opt->opt_val) : NULL;
+ newopt = xf86addNewOption(newopt, strdup(opt->opt_name), val);
newopt->opt_used = opt->opt_used;
if (opt->opt_comment)
newopt->opt_comment = strdup(opt->opt_comment);