[PATCH] systemctl: plug a leak upon create_symlink mismatch

Jim Meyering meyering at redhat.com
Wed Jun 15 07:47:39 PDT 2011


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

diff --git a/src/systemctl.c b/src/systemctl.c
index 2bd173c..e6817ee 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -3957,18 +3957,19 @@ static int create_symlink(const char *verb, const char *old_path, const char *ne
                         log_error("readlink() failed: %s", strerror(-r));
                         return r;
                 }

                 if (streq(dest, old_path)) {
                         free(dest);
                         return 1;
                 }

+                free(dest);
                 return 0;
         }

         assert_not_reached("Unknown action.");
 }

 static int install_info_symlink_alias(const char *verb, InstallInfo *i, const char *config_path) {
         char **s;
         char *alias_path = NULL;
--
1.7.6.rc0.293.g40857


More information about the systemd-devel mailing list