@@ -198,11 +198,14 @@ recording::context::context (context *parent_ctxt)
if (parent_ctxt)
{
- /* Inherit options from parent.
- Note that the first memcpy means copying pointers to strings. */
- memcpy (m_str_options,
- parent_ctxt->m_str_options,
- sizeof (m_str_options));
+ /* Inherit options from parent. */
+ for (unsigned i = 0;
+ i < sizeof (m_str_options) / sizeof (m_str_options[0]);
+ i++)
+ {
+ const char *parent_opt = parent_ctxt->m_str_options[i];
+ m_str_options[i] = parent_opt ? xstrdup (parent_opt) : NULL;
+ }
memcpy (m_int_options,
parent_ctxt->m_int_options,
sizeof (m_int_options));