]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: check recount_widths() return value
authorKarel Zak <kzak@redhat.com>
Tue, 6 May 2014 08:21:24 +0000 (10:21 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 6 May 2014 08:21:24 +0000 (10:21 +0200)
Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols/src/table_print.c

index 29420537e58690d5b0a4f882809acaacfb997173..24b73f942d50172d791287b7c8c9221b391d9095 100644 (file)
@@ -738,14 +738,18 @@ int scols_print_table(struct libscols_table *tb)
        if (!buf)
                return -ENOMEM;
 
-       if (!(scols_table_is_raw(tb) || scols_table_is_export(tb)))
+       if (!(scols_table_is_raw(tb) || scols_table_is_export(tb))) {
                rc = recount_widths(tb, buf);
+               if (rc != 0)
+                       goto done;
+       }
 
        if (scols_table_is_tree(tb))
                rc = print_tree(tb, buf);
        else
                rc = print_table(tb, buf);
 
+done:
        free_buffer(buf);
        return rc;
 }