]> granicus.if.org Git - sudo/commitdiff
delref sudo_user.pw, runas_pw and runas_gr immediately before we exec.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 5 Aug 2010 14:17:21 +0000 (10:17 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 5 Aug 2010 14:17:21 +0000 (10:17 -0400)
--HG--
branch : 1.7

sudo.c

diff --git a/sudo.c b/sudo.c
index 04fd3f2886b3645ecef75372569a92c398ae9e2c..63c727c6c16b97b849315276ec1083013f3bfc93 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -908,6 +908,10 @@ exec_setup(rbac_enabled, ttyname, ttyfd)
     /* Close the password and group files and free up memory. */
     sudo_endpwent();
     sudo_endgrent();
+    pw_delref(sudo_user.pw);
+    pw_delref(runas_pw);
+    if (runas_gr != NULL)
+       gr_delref(runas_gr);
 
     rval = TRUE;
 
@@ -962,6 +966,12 @@ run_command(path, argv, envp, uid, dowait)
 #ifdef _PATH_SUDO_IO_LOGDIR
     io_log_close();
 #endif
+    sudo_endpwent();
+    sudo_endgrent();
+    pw_delref(sudo_user.pw);
+    pw_delref(runas_pw);
+    if (runas_gr != NULL)
+       gr_delref(runas_gr);
     return(exitcode);
 }