tabular_output: allocate footer-line when set for the first time
authorChristof Hanke <christof.hanke@rzg.mpg.de>
Wed, 18 Nov 2015 13:02:50 +0000 (14:02 +0100)
committerBenjamin Kaduk <kaduk@mit.edu>
Thu, 19 Nov 2015 03:33:58 +0000 (22:33 -0500)
If the footer line is not allocated, programs segfault at runtime.
The printFooter functions should check if the footer
is allocated before printing them.

Change-Id: Ib4066a67ee104be918811e178c0b7d7d33d790b8
Reviewed-on: http://gerrit.openafs.org/11753
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/util/tabular_output.c

index 6c053cc..7c883a8 100644 (file)
@@ -90,6 +90,8 @@ util_setTableBodyRow(struct util_Table *Table, int RowIndex, char **Contents) {
 }
 
 int util_setTableFooter(struct util_Table * Table, char ** Contents) {
+    if (Table->Footer != NULL)
+        Table->Footer = newTableRow(Table);
     return do_setTableRow(Table,Table->Footer,Contents);
 }