summaryrefslogtreecommitdiff
path: root/usr.bin/finger
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-01-09 17:17:40 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-01-09 17:17:40 +0000
commit720c849328387b8f7ad3afd30ff62a20a258a99c (patch)
tree09951c0bc6580f050471b982b780bbf11bbefe94 /usr.bin/finger
parent801d9df61619fcff5bb16d8af0ddaf11b9cc545b (diff)
Fix PR 379. Don't recycle the malloc'd space in vs().
Diffstat (limited to 'usr.bin/finger')
-rw-r--r--usr.bin/finger/util.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.bin/finger/util.c b/usr.bin/finger/util.c
index 1de5eec6cf6..bcb50b75b6e 100644
--- a/usr.bin/finger/util.c
+++ b/usr.bin/finger/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.8 1997/06/30 06:24:47 deraadt Exp $ */
+/* $OpenBSD: util.c,v 1.9 1998/01/09 17:17:39 millert Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@@ -39,7 +39,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)util.c 5.14 (Berkeley) 1/17/91";*/
-static char rcsid[] = "$OpenBSD: util.c,v 1.8 1997/06/30 06:24:47 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: util.c,v 1.9 1998/01/09 17:17:39 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -384,17 +384,14 @@ prphone(num)
/* Like strvis(), but use malloc() to get the space and return a pointer
* to the beginning of the converted string, not the end.
*
- * Recycle the malloc()ed area on each call. This leads to a leak which
- * does not grow.
+ * The caller is responsible for free()'ing the returned string.
*/
char *
vs(src)
char *src;
{
- static char *dst = NULL;
+ char *dst;
- if (dst != NULL)
- free(dst);
if ((dst = malloc((4 * strlen(src)) + 1)) == NULL)
err(1, "malloc failed");