From: Zbigniew Jędrzejewski-Szmek Date: Mon, 27 Nov 2017 16:13:04 +0000 (+0000) Subject: core/umount: use _cleanup_ in one more place X-Git-Tag: v236~102^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=595c66a3db50b23d25aee24f253c2a9009344956;p=thirdparty%2Fsystemd.git core/umount: use _cleanup_ in one more place --- diff --git a/src/core/umount.c b/src/core/umount.c index cd195e12af6..cd58a9cf6d7 100644 --- a/src/core/umount.c +++ b/src/core/umount.c @@ -159,7 +159,7 @@ static int swap_list_get(MountPoint **head) { for (i = 2;; i++) { MountPoint *swap; - char *dev = NULL, *d; + _cleanup_free_ char *dev = NULL, *d = NULL; int k; k = fscanf(proc_swaps, @@ -175,27 +175,21 @@ static int swap_list_get(MountPoint **head) { break; log_warning("Failed to parse /proc/swaps:%u.", i); - free(dev); continue; } - if (endswith(dev, " (deleted)")) { - free(dev); + if (endswith(dev, " (deleted)")) continue; - } r = cunescape(dev, UNESCAPE_RELAX, &d); - free(dev); if (r < 0) return r; swap = new0(MountPoint, 1); - if (!swap) { - free(d); + if (!swap) return -ENOMEM; - } - swap->path = d; + free_and_replace(swap->path, d); LIST_PREPEND(mount_point, *head, swap); }