From e1d758033dc7e101ab32323a0f1649d8daf56a22 Mon Sep 17 00:00:00 2001 From: Ronny Chevalier Date: Tue, 24 Jun 2014 19:00:32 +0200 Subject: use more _cleanup_ macro --- src/core/umount.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/core/umount.c') diff --git a/src/core/umount.c b/src/core/umount.c index a30f6740fa..cffa45327b 100644 --- a/src/core/umount.c +++ b/src/core/umount.c @@ -126,9 +126,8 @@ static int mount_points_list_get(MountPoint **head) { } static int swap_list_get(MountPoint **head) { - FILE *proc_swaps; + _cleanup_fclose_ FILE *proc_swaps = NULL; unsigned int i; - int r; assert(head); @@ -168,26 +167,19 @@ static int swap_list_get(MountPoint **head) { free(dev); if (!d) { - r = -ENOMEM; - goto finish; + return -ENOMEM; } if (!(swap = new0(MountPoint, 1))) { free(d); - r = -ENOMEM; - goto finish; + return -ENOMEM; } swap->path = d; LIST_PREPEND(mount_point, *head, swap); } - r = 0; - -finish: - fclose(proc_swaps); - - return r; + return 0; } static int loopback_list_get(MountPoint **head) { -- cgit v1.2.3-54-g00ecf