Handle NULL in gcc_jit_context_set_str_option
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 19 Dec 2014 19:33:29 +0000 (19:33 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Fri, 19 Dec 2014 19:33:29 +0000 (19:33 +0000)
gcc/jit/ChangeLog:
* jit-recording.c (gcc::jit::recording::context::set_str_option):
Handle NULL.

From-SVN: r218969

gcc/jit/ChangeLog
gcc/jit/jit-recording.c

index 71755fff91acbf2af2161d36548b2fb3307b32b5..639f8e6cd9ccb2fa24a63c8cb8cd89a6c11ce3b9 100644 (file)
@@ -1,3 +1,8 @@
+2014-12-19  David Malcolm  <dmalcolm@redhat.com>
+
+       * jit-recording.c (gcc::jit::recording::context::set_str_option):
+       Handle NULL.
+
 2014-12-11  David Malcolm  <dmalcolm@redhat.com>
 
        * docs/cp/topics/contexts.rst (gccjit::context::set_str_option):
index 9d6d26a92a1bfe759808fcff22e01486ef9a2af7..7d9da24739237aefe7dc6ed44a2157266432c858 100644 (file)
@@ -831,7 +831,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