From 140b0061723ef22f870732be4b47a13b92bdb49b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 6 May 2014 10:21:24 +0200 Subject: [PATCH] libsmartcols: check recount_widths() return value Reported-by: Sami Kerola Signed-off-by: Karel Zak --- libsmartcols/src/table_print.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libsmartcols/src/table_print.c b/libsmartcols/src/table_print.c index 29420537e..24b73f942 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; }