]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: use TT_FL_FREEDATA for tt table
authorKarel Zak <kzak@redhat.com>
Mon, 10 Jun 2013 10:00:12 +0000 (12:00 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 16 Sep 2013 14:46:59 +0000 (16:46 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu.c

index 98cee16354921f6e7a94ae5b629be5a6757ce2a8..2655622172887d24fc5035e97937f41610136e72 100644 (file)
@@ -1127,7 +1127,7 @@ print_readable(struct lscpu_desc *desc, int cols[], int ncols,
 {
        int i;
        char buf[BUFSIZ], *data;
-       struct tt *tt = tt_new_table(0);
+       struct tt *tt = tt_new_table(TT_FL_FREEDATA);
 
        if (!tt)
                 err(EXIT_FAILURE, _("failed to initialize output table"));
@@ -1153,11 +1153,13 @@ print_readable(struct lscpu_desc *desc, int cols[], int ncols,
                for (c = 0; c < ncols; c++) {
                        data = get_cell_data(desc, i, cols[c], mod,
                                             buf, sizeof(buf));
-                       tt_line_set_data(line, c, data && *data ? xstrdup(data) : "-");
+                       tt_line_set_data(line, c,
+                                       xstrdup(data && *data ? data : "-"));
                }
        }
 
        tt_print_table(tt);
+       tt_free_table(tt);
 }
 
 /* output formats "<key>  <value>"*/