From: Ben Pfaff <blp@gnu.org>
Date: Wed, 1 Jul 2009 22:53:44 +0000 (-0700)
Subject: output: Fix segfault for writing output outside a command invocation.
X-Git-Tag: sav-api~521
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1388653736c11bce0f3b2be983065730bc895cc3;p=pspp

output: Fix segfault for writing output outside a command invocation.

Running "make check" made this problem obvious, but it hadn't shown up in
my in-GUI testing.
---

diff --git a/src/output/manager.c b/src/output/manager.c
index 505362d394..f418cd0d06 100644
--- a/src/output/manager.c
+++ b/src/output/manager.c
@@ -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)
     {