chiark / gitweb /
Use _cleanup_ when reading config files
[elogind.git] / src / core / main.c
index 4d21dd97a3e3873dd1d4cf431d0c8c650815a448..921476a042c7d9be0f0b82ee18042f84eb1cf074 100644 (file)
@@ -704,7 +704,7 @@ static int parse_config_file(void) {
                 { NULL, NULL, NULL, 0, NULL }
         };
 
-        FILE *f;
+        FILE _cleanup_fclose_ *f;
         const char *fn;
         int r;
 
@@ -722,8 +722,6 @@ static int parse_config_file(void) {
         if (r < 0)
                 log_warning("Failed to parse configuration file: %s", strerror(-r));
 
-        fclose(f);
-
         return 0;
 }