util: in util_newTable, don't leak Table on error
authorGarrett Wollman <wollman@csail.mit.edu>
Sun, 15 Jul 2012 18:54:47 +0000 (14:54 -0400)
committerDerrick Brashear <shadow@dementix.org>
Mon, 16 Jul 2012 12:47:40 +0000 (05:47 -0700)
It is unlikely that this memory leak actually matters as the caller
will normally just exit.

This whole source file could stand to be reformatted.

Change-Id: Ic5cb52a73ac09ae492c6e6ab606dfaf92a1ab8bf
Reviewed-on: http://gerrit.openafs.org/7767
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

src/util/tabular_output.c

index 5866fbe..cfd43b2 100644 (file)
@@ -369,6 +369,7 @@ util_newTable(int Type, int numColumns, char **ColumnHeaders, int *ColumnContent
     if (sortByColumn < 0 || sortByColumn > numColumns) {
         fprintf(stderr,"Invalid Table Sortkey: %d.\n", sortByColumn);
        errno=EINVAL;
+       free(Table);
        return NULL;
     }
     if (sortByColumn > 0 )