]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: fix buffer usage
authorKarel Zak <kzak@redhat.com>
Fri, 18 Apr 2014 10:01:59 +0000 (12:01 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 18 Apr 2014 10:01:59 +0000 (12:01 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols/src/table_print.c

index c3dcfaefdeab6950a0b0088035caee9d1fb7ebfe..29420537e58690d5b0a4f882809acaacfb997173 100644 (file)
@@ -297,6 +297,8 @@ static int cell_to_buffer(struct libscols_table *tb,
        assert(buf);
        assert(cl->seqnum <= tb->ncols);
 
+       buffer_reset_data(buf);
+
        ce = scols_line_get_cell(ln, cl->seqnum);
        data = ce ? scols_cell_get_data(ce) : NULL;
        if (!data)
@@ -308,8 +310,6 @@ static int cell_to_buffer(struct libscols_table *tb,
        /*
         * Tree stuff
         */
-       buffer_reset_data(buf);
-
        if (ln->parent) {
                rc = line_ascii_art_to_buffer(tb, ln->parent, buf);