]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: Fix double free of *_chs strings in fdisk_partition
authorVojtech Trefny <vtrefny@redhat.com>
Fri, 19 Jul 2019 11:35:11 +0000 (13:35 +0200)
committerVojtech Trefny <vtrefny@redhat.com>
Fri, 19 Jul 2019 11:42:49 +0000 (13:42 +0200)
__copy_partition doesn't duplicate these strings which leads to
occasional double free.

Signed-off-by: Vojtech Trefny <vtrefny@redhat.com>
libfdisk/src/partition.c

index 05474a041c2b52364a07ba7da4ec58b7c4f77783..55ce1ca5cce38fe9a104b1b4f4fe65a8f37c7081 100644 (file)
@@ -100,6 +100,10 @@ static struct fdisk_partition *__copy_partition(struct fdisk_partition *o)
                n->fsuuid = strdup(o->fsuuid);
        if (o->fslabel)
                n->fslabel = strdup(o->fslabel);
+       if (o->start_chs)
+               n->start_chs = strdup(o->start_chs);
+       if (o->end_chs)
+               n->end_chs = strdup(o->end_chs);
 
        return n;
 }