diff options
author | Mike Pechkin <mpech@cvs.openbsd.org> | 2002-02-15 12:41:00 +0000 |
---|---|---|
committer | Mike Pechkin <mpech@cvs.openbsd.org> | 2002-02-15 12:41:00 +0000 |
commit | 1b469fee148ffc20c8465b58ea3865fb303f26d3 (patch) | |
tree | 8e489389d338adf6737b693b06daa703813f3c0f /libexec/ftp-proxy/util.c | |
parent | eec0ce51a048ffa700a92bdd3302d4fa9f5c3859 (diff) |
Fix memory leak in get_proxy_env().
deraadt@ ok
Diffstat (limited to 'libexec/ftp-proxy/util.c')
-rw-r--r-- | libexec/ftp-proxy/util.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/libexec/ftp-proxy/util.c b/libexec/ftp-proxy/util.c index a0b2755bf2d..86b18da0fa5 100644 --- a/libexec/ftp-proxy/util.c +++ b/libexec/ftp-proxy/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.6 2001/09/15 03:54:40 frantzen Exp $ */ +/* $OpenBSD: util.c,v 1.7 2002/02/15 12:40:59 mpech Exp $ */ /* * Copyright (c) 1996-2001 @@ -77,7 +77,6 @@ get_proxy_env(int connected_fd, struct sockaddr_in *real_server_sa_ptr, struct sockaddr_in *client_sa_ptr) { struct pfioc_natlook natlook; - char *client; int slen, fd; slen = sizeof(*real_server_sa_ptr); @@ -110,12 +109,6 @@ get_proxy_env(int connected_fd, struct sockaddr_in *real_server_sa_ptr, * Open the pf device and lookup the mapping pair to find * the original address we were supposed to connect to. */ - client = strdup(inet_ntoa(client_sa_ptr->sin_addr)); - if (client == NULL) { - errno = ENOMEM; - return(-1); - } - fd = open("/dev/pf", O_RDWR); if (fd == -1) { syslog(LOG_ERR, "Can't open /dev/pf (%m)"); @@ -125,7 +118,8 @@ get_proxy_env(int connected_fd, struct sockaddr_in *real_server_sa_ptr, if (ioctl(fd, DIOCNATLOOK, &natlook) == -1) { syslog(LOG_INFO, "pf nat lookup failed (%m), connection from %s:%hu", - client, ntohs(client_sa_ptr->sin_port)); + inet_ntoa(client_sa_ptr->sin_addr), + ntohs(client_sa_ptr->sin_port)); close(fd); return(-1); } |