aboutsummaryrefslogtreecommitdiff
path: root/inet/rexec.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-08-27 21:44:13 +0000
committerUlrich Drepper <drepper@redhat.com>1999-08-27 21:44:13 +0000
commit8a3c8443579971eff1d42db864952ca8a910780c (patch)
tree4302fc1595fd917b66478ff5220aad574ef990a1 /inet/rexec.c
parent4744a4116a89680119801e080cfccea14f15f5aa (diff)
downloadglibc-8a3c8443579971eff1d42db864952ca8a910780c.tar
glibc-8a3c8443579971eff1d42db864952ca8a910780c.tar.gz
glibc-8a3c8443579971eff1d42db864952ca8a910780c.tar.bz2
glibc-8a3c8443579971eff1d42db864952ca8a910780c.zip
Update.
* inet/rexec.c (rexec): Free memory if strings were allocated in ruserpass. Reported by Andrew Morton <morton@nortelnetworks.com>. 1999-08-27 Ulrich Drepper <drepper@cygnus.com>
Diffstat (limited to 'inet/rexec.c')
-rw-r--r--inet/rexec.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/inet/rexec.c b/inet/rexec.c
index 897030e6b9..643f277d97 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -54,6 +54,8 @@ rexec(ahost, rport, name, pass, cmd, fd2p)
{
struct sockaddr_in sin, sin2, from;
struct hostent hostbuf, *hp;
+ const char *orig_name = name;
+ const char *orig_pass = pass;
size_t hstbuflen;
char *hsttmpbuf;
u_short port;
@@ -138,6 +140,14 @@ retry:
/* should public key encypt the password here */
(void) __write(s, pass, strlen(pass) + 1);
(void) __write(s, cmd, strlen(cmd) + 1);
+
+ /* We don't need the memory allocated for the name and the password
+ in ruserpass anymore. */
+ if (name != orig_name)
+ free (name);
+ if (pass != orig_pass)
+ free (pass);
+
if (__read(s, &c, 1) != 1) {
perror(*ahost);
goto bad;