summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/table_print.c
diff options
context:
space:
mode:
authorKarel Zak2014-05-06 10:21:24 +0200
committerKarel Zak2014-05-06 10:21:24 +0200
commit140b0061723ef22f870732be4b47a13b92bdb49b (patch)
tree65056f96bf8bcc6423517b72c0fccda5b7251c7f /libsmartcols/src/table_print.c
parentlib/pager: use names when referring to standard file descriptors (diff)
downloadkernel-qcow2-util-linux-140b0061723ef22f870732be4b47a13b92bdb49b.tar.gz
kernel-qcow2-util-linux-140b0061723ef22f870732be4b47a13b92bdb49b.tar.xz
kernel-qcow2-util-linux-140b0061723ef22f870732be4b47a13b92bdb49b.zip
libsmartcols: check recount_widths() return value
Reported-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols/src/table_print.c')
-rw-r--r--libsmartcols/src/table_print.c6
1 files changed, 5 insertions, 1 deletions
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;
}