tabular_output: don't leak table struct on error exit
authorGarrett Wollman <wollman@csail.mit.edu>
Wed, 25 Jul 2012 04:41:05 +0000 (00:41 -0400)
committerDerrick Brashear <shadow@dementix.org>
Thu, 26 Jul 2012 18:49:56 +0000 (11:49 -0700)
The caller is almost certainly going to exit when we return, but
all the same, don't leak the table description structure in the
error exit.  Makes the static analyzer happier.

Change-Id: I55e986a3601968751921ee38badf5bb86cd3174f
Reviewed-on: http://gerrit.openafs.org/7870
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

src/util/tabular_output.c

index cfd43b2..7f8eb29 100644 (file)
@@ -399,6 +399,7 @@ util_newTable(int Type, int numColumns, char **ColumnHeaders, int *ColumnContent
                 break;
         default :
                 fprintf(stderr,"Error. Invalid TableType: %d.\n", Table->Type);
+               free(Table);
                errno=EINVAL;
                 return NULL;
     }