From: Karel Zak Date: Tue, 6 May 2014 08:21:24 +0000 (+0200) Subject: libsmartcols: check recount_widths() return value X-Git-Tag: v2.25-rc1~231 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=140b0061723ef22f870732be4b47a13b92bdb49b;p=thirdparty%2Futil-linux.git libsmartcols: check recount_widths() return value Reported-by: Sami Kerola Signed-off-by: Karel Zak --- diff --git a/libsmartcols/src/table_print.c b/libsmartcols/src/table_print.c index 29420537e5..24b73f942d 100644 --- a/libsmartcols/src/table_print.c +++ b/libsmartcols/src/table_print.c @@ -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; }