diff mbox

[committed] Handle NULL in gcc_jit_context_set_str_option

Message ID 1419018163-33525-1-git-send-email-dmalcolm@redhat.com
State New
Headers show

Commit Message

David Malcolm Dec. 19, 2014, 7:42 p.m. UTC
r218617 broke test-error-pr63969-missing-driver.c.

The commit added an xstrdup of new string option values on a
gcc_jit_context, but string option values are allowed to be NULL.

Handle the NULL case.

Committed to trunk as r218969.

gcc/jit/ChangeLog:
	* jit-recording.c (gcc::jit::recording::context::set_str_option):
	Handle NULL.
---
 gcc/jit/jit-recording.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/gcc/jit/jit-recording.c b/gcc/jit/jit-recording.c
index 1f80001..400a047 100644
--- a/gcc/jit/jit-recording.c
+++ b/gcc/jit/jit-recording.c
@@ -845,7 +845,7 @@  recording::context::set_str_option (enum gcc_jit_str_option opt,
       return;
     }
   free (m_str_options[opt]);
-  m_str_options[opt] = xstrdup (value);
+  m_str_options[opt] = value ? xstrdup (value) : NULL;
 }
 
 /* Set the given integer option for this context, or add an error if