]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
wdctl: use TT_FL_FREEDATA for tt table
authorKarel Zak <kzak@redhat.com>
Mon, 10 Jun 2013 09:08:08 +0000 (11:08 +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/wdctl.c

index af9a3933871dba31ac0f5d5dc5a392145d9c78d6..2698853e9eeff5ff408f83f6d8bb4ea63d9d3d6c 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "nls.h"
 #include "c.h"
+#include "xalloc.h"
 #include "closestream.h"
 #include "optutils.h"
 #include "pathnames.h"
@@ -232,7 +233,7 @@ static void add_flag_line(struct tt *tt, struct wdinfo *wd, const struct wdflag
                }
 
                if (str)
-                       tt_line_set_data(line, i, str);
+                       tt_line_set_data(line, i, xstrdup(str));
        }
 }
 
@@ -244,7 +245,7 @@ static int show_flags(struct wdinfo *wd, int tt_flags, uint32_t wanted)
        uint32_t flags;
 
        /* create output table */
-       tt = tt_new_table(tt_flags);
+       tt = tt_new_table(tt_flags | TT_FL_FREEDATA);
        if (!tt) {
                warn(_("failed to initialize output table"));
                return -1;