]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: don't call free_buffer() for uninitialized variable [coverity scan]
authorKarel Zak <kzak@redhat.com>
Wed, 11 Oct 2017 13:06:41 +0000 (15:06 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 11 Oct 2017 13:06:41 +0000 (15:06 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols/src/table_print.c

index 472c3616c6f41ffd994feddbaa2076865d56c1a9..7a2c1a3dca8a3f8de5419be7462c01334c413110 100644 (file)
@@ -1409,6 +1409,7 @@ static int initialize_printing(struct libscols_table *tb, struct libscols_buffer
        int rc;
 
        DBG(TAB, ul_debugobj(tb, "initialize printing"));
+       *buf = NULL;
 
        if (!tb->symbols) {
                rc = scols_table_set_default_symbols(tb);
@@ -1516,7 +1517,7 @@ int scols_table_print_range(      struct libscols_table *tb,
                                struct libscols_line *start,
                                struct libscols_line *end)
 {
-       struct libscols_buffer *buf;
+       struct libscols_buffer *buf = NULL;
        struct libscols_iter itr;
        int rc;
 
@@ -1602,7 +1603,7 @@ int scols_table_print_range_to_string(
 static int __scols_print_table(struct libscols_table *tb, int *is_empty)
 {
        int rc = 0;
-       struct libscols_buffer *buf;
+       struct libscols_buffer *buf = NULL;
 
        if (!tb)
                return -EINVAL;