login: free fromhost upon cleaning up
authorAlexander Shishkin <virtuoso@slind.org>
Wed, 27 Oct 2010 16:52:40 +0000 (19:52 +0300)
committerDenys Vlasenko <vda.linux@googlemail.com>
Thu, 28 Oct 2010 03:49:55 +0000 (05:49 +0200)
Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
loginutils/login.c

index e104fbb932d7e59beae2fdece0bbcc21e61fee5a..3065eaa5b298d9e952bef4bf707a0d993106d105 100644 (file)
@@ -364,6 +364,10 @@ int login_main(int argc UNUSED_PARAM, char **argv)
                if (++count == 3) {
                        syslog(LOG_WARNING, "invalid password for '%s'%s",
                                                username, fromhost);
+
+                       if (ENABLE_FEATURE_CLEAN_UP)
+                               free(fromhost);
+
                        return EXIT_FAILURE;
                }
                username[0] = '\0';
@@ -401,6 +405,9 @@ int login_main(int argc UNUSED_PARAM, char **argv)
        if (pw->pw_uid == 0)
                syslog(LOG_INFO, "root login%s", fromhost);
 
+       if (ENABLE_FEATURE_CLEAN_UP)
+               free(fromhost);
+
        /* well, a simple setexeccon() here would do the job as well,
         * but let's play the game for now */
        IF_SELINUX(set_current_security_context(user_sid);)