chiark / gitweb /
use more _cleanup_ macro
[elogind.git] / src / core / umount.c
index a30f6740fada15b5b00214ede9e2173b0517ffe4..cffa45327be531784ac64cc9864c82ff622e4fe4 100644 (file)
@@ -126,9 +126,8 @@ static int mount_points_list_get(MountPoint **head) {
 }
 
 static int swap_list_get(MountPoint **head) {
 }
 
 static int swap_list_get(MountPoint **head) {
-        FILE *proc_swaps;
+        _cleanup_fclose_ FILE *proc_swaps = NULL;
         unsigned int i;
         unsigned int i;
-        int r;
 
         assert(head);
 
 
         assert(head);
 
@@ -168,26 +167,19 @@ static int swap_list_get(MountPoint **head) {
                 free(dev);
 
                 if (!d) {
                 free(dev);
 
                 if (!d) {
-                        r = -ENOMEM;
-                        goto finish;
+                        return -ENOMEM;
                 }
 
                 if (!(swap = new0(MountPoint, 1))) {
                         free(d);
                 }
 
                 if (!(swap = new0(MountPoint, 1))) {
                         free(d);
-                        r = -ENOMEM;
-                        goto finish;
+                        return -ENOMEM;
                 }
 
                 swap->path = d;
                 LIST_PREPEND(mount_point, *head, swap);
         }
 
                 }
 
                 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) {
 }
 
 static int loopback_list_get(MountPoint **head) {