summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/table.c
diff options
context:
space:
mode:
authorKarel Zak2014-04-02 14:05:10 +0200
committerKarel Zak2014-04-03 12:29:20 +0200
commit1424fe8c86b376ce1f908aae79f2e48639de115a (patch)
treec8f14ac0f062647f71f87c0abe40b396e7a77a94 /libsmartcols/src/table.c
parentlsblk: remove unnecessary code (diff)
downloadkernel-qcow2-util-linux-1424fe8c86b376ce1f908aae79f2e48639de115a.tar.gz
kernel-qcow2-util-linux-1424fe8c86b376ce1f908aae79f2e48639de115a.tar.xz
kernel-qcow2-util-linux-1424fe8c86b376ce1f908aae79f2e48639de115a.zip
libsmartcols: init symbols when necessary
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols/src/table.c')
-rw-r--r--libsmartcols/src/table.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c
index 94df47b05..dd26410fe 100644
--- a/libsmartcols/src/table.c
+++ b/libsmartcols/src/table.c
@@ -60,9 +60,11 @@ struct libscols_table *scols_new_table(struct libscols_symbols *syms)
INIT_LIST_HEAD(&tb->tb_lines);
INIT_LIST_HEAD(&tb->tb_columns);
- if (scols_table_set_symbols(tb, syms) == 0)
- return tb;
+ if (syms && scols_table_set_symbols(tb, syms) != 0)
+ goto err;
+ return tb;
+err:
scols_unref_table(tb);
return NULL;
}