summaryrefslogtreecommitdiff
path: root/libexec/ftpd
diff options
context:
space:
mode:
authorMoritz Jodeit <moritz@cvs.openbsd.org>2007-07-27 14:12:47 +0000
committerMoritz Jodeit <moritz@cvs.openbsd.org>2007-07-27 14:12:47 +0000
commit1c7596550822f967b125e358751560622173b1f7 (patch)
treea4ba0e19e4fe8180fc849bbf2154f39b0fae2147 /libexec/ftpd
parent09f18fbfe4af968fafeee0f81109ce7f67869d92 (diff)
Fix potential memory leak, when snprintf(3) returns an empty buffer.
OK ray@
Diffstat (limited to 'libexec/ftpd')
-rw-r--r--libexec/ftpd/ftpd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 9e3f67cabc5..bddfe45b720 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftpd.c,v 1.178 2007/06/21 02:22:51 ray Exp $ */
+/* $OpenBSD: ftpd.c,v 1.179 2007/07/27 14:12:46 moritz Exp $ */
/* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */
/*
@@ -70,7 +70,7 @@ static const char copyright[] =
static const char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94";
#else
static const char rcsid[] =
- "$OpenBSD: ftpd.c,v 1.178 2007/06/21 02:22:51 ray Exp $";
+ "$OpenBSD: ftpd.c,v 1.179 2007/07/27 14:12:46 moritz Exp $";
#endif
#endif /* not lint */
@@ -2794,6 +2794,7 @@ logxfer(char *name, off_t size, time_t start)
'o', ((guest) ? 'a' : 'r'),
vpw, 0 /* none yet */,
((guest) ? "*" : pw->pw_name), dhostname);
+ free(vpw);
if (len >= sizeof(buf) || len == -1) {
if ((len = strlen(buf)) == 0)
@@ -2801,7 +2802,6 @@ logxfer(char *name, off_t size, time_t start)
buf[len - 1] = '\n';
}
write(statfd, buf, len);
- free(vpw);
}
}