From: Yu Watanabe Date: Tue, 6 Sep 2022 01:50:19 +0000 (+0900) Subject: dissect-image: drop unnecessary duplication of partition device node X-Git-Tag: v252-rc1~236^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F24571%2Fhead;p=thirdparty%2Fsystemd.git dissect-image: drop unnecessary duplication of partition device node --- diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c index d5425c4de48..b186c3a728a 100644 --- a/src/shared/dissect-image.c +++ b/src/shared/dissect-image.c @@ -723,7 +723,7 @@ int dissect_image( } if (designator != _PARTITION_DESIGNATOR_INVALID) { - _cleanup_free_ char *t = NULL, *n = NULL, *o = NULL, *l = NULL; + _cleanup_free_ char *t = NULL, *o = NULL, *l = NULL; const char *options = NULL; if (m->partitions[designator].found) { @@ -745,10 +745,6 @@ int dissect_image( return -ENOMEM; } - n = strdup(node); - if (!n) - return -ENOMEM; - if (label) { l = strdup(label); if (!l) @@ -768,7 +764,7 @@ int dissect_image( .rw = rw, .growfs = growfs, .architecture = architecture, - .node = TAKE_PTR(n), + .node = TAKE_PTR(node), .fstype = TAKE_PTR(t), .label = TAKE_PTR(l), .uuid = id, @@ -801,7 +797,7 @@ int dissect_image( break; case 0xEA: { /* Boot Loader Spec extended $BOOT partition */ - _cleanup_free_ char *n = NULL, *o = NULL; + _cleanup_free_ char *o = NULL; sd_id128_t id = SD_ID128_NULL; const char *sid, *options = NULL; @@ -813,10 +809,6 @@ int dissect_image( if (sid) (void) sd_id128_from_string(sid, &id); - n = strdup(node); - if (!n) - return -ENOMEM; - options = mount_options_from_designator(mount_options, PARTITION_XBOOTLDR); if (options) { o = strdup(options); @@ -830,7 +822,7 @@ int dissect_image( .rw = true, .growfs = false, .architecture = _ARCHITECTURE_INVALID, - .node = TAKE_PTR(n), + .node = TAKE_PTR(node), .uuid = id, .mount_options = TAKE_PTR(o), .offset = (uint64_t) start * 512,