]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsblk: fix -D segfault
authorKarel Zak <kzak@redhat.com>
Mon, 18 Nov 2013 10:27:35 +0000 (11:27 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 18 Nov 2013 10:27:35 +0000 (11:27 +0100)
References: https://bugzilla.redhat.com/show_bug.cgi?id=1031262
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/lsblk.c

index 9f7f1b6a36c0f5ab991122b6ae322163f7575d90..9b53be35d1f825f55bdd9fc4f9e6e8ecdc277b3f 100644 (file)
@@ -903,7 +903,7 @@ static void set_tt_data(struct blkdev_cxt *cxt, int col, int id, struct tt_line
                if (cxt->discard && p)
                        tt_line_set_data(ln, col, p);
                else
-                       tt_line_set_data(ln, col, "0");
+                       tt_line_set_data(ln, col, xstrdup("0"));
                break;
        case COL_DGRAN:
                if (lsblk->bytes)
@@ -936,7 +936,7 @@ static void set_tt_data(struct blkdev_cxt *cxt, int col, int id, struct tt_line
                if (cxt->discard && p)
                        tt_line_set_data(ln, col, p);
                else
-                       tt_line_set_data(ln, col, "0");
+                       tt_line_set_data(ln, col, xstrdup("0"));
                break;
        case COL_WSAME:
                if (lsblk->bytes)
@@ -948,7 +948,7 @@ static void set_tt_data(struct blkdev_cxt *cxt, int col, int id, struct tt_line
                                           "queue/write_same_max_bytes", &x) == 0)
                                p = size_to_human_string(SIZE_SUFFIX_1LETTER, x);
                }
-               tt_line_set_data(ln, col, p ? p : "0");
+               tt_line_set_data(ln, col, p ? p : xstrdup("0"));
                break;
        };
 }