[systemd-devel] [PATCH 2/2] systemctl: fix a FILE* leak

Michal Schmidt mschmidt at redhat.com
Mon Jun 13 05:19:53 PDT 2011


In practice it does not really matter, but let's be nice and close the
file.
---

 src/systemctl.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/systemctl.c b/src/systemctl.c
index 889e3ee..2bd173c 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -4172,8 +4172,10 @@ static int install_info_apply(const char *verb, LookupPaths *paths, InstallInfo
         if (streq(verb, "is-enabled") &&
             strv_isempty(i->aliases) &&
             strv_isempty(i->wanted_by) &&
-            !path_startswith(filename, "/etc"))
+            !path_startswith(filename, "/etc")) {
+                fclose(f);
                 return 1;
+        }
 
         n_symlinks += strv_length(i->aliases);
         n_symlinks += strv_length(i->wanted_by);



More information about the systemd-devel mailing list