output: Fix segfault for writing output outside a command invocation.
authorBen Pfaff <blp@gnu.org>
Wed, 1 Jul 2009 22:53:44 +0000 (15:53 -0700)
committerBen Pfaff <blp@gnu.org>
Wed, 1 Jul 2009 22:53:44 +0000 (15:53 -0700)
Running "make check" made this problem obvious, but it hadn't shown up in
my in-GUI testing.

src/output/manager.c

index 505362d39424f7fa3e15dd552a096d0eb8d70282..f418cd0d06ca6848e56250a8d53a420d327f54f7 100644 (file)
@@ -134,7 +134,7 @@ som_submit (struct som_entity *t)
     subtable_num++;
   t->table_num = table_num;
   t->subtable_num = subtable_num;
-  t->command_name = xstrdup (command_name);
+  t->command_name = command_name ? xstrdup (command_name) : NULL;
 
   if (t->type == SOM_TABLE)
     {