summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1998-09-16 04:17:47 +0000
committerimp <imp@FreeBSD.org>1998-09-16 04:17:47 +0000
commitbfe73fd683053201c326f9ff2c8e5e0f69cc7fe7 (patch)
treeb17d45198953bfbbad4bfd632dfdf1a37b7159d2 /lib/libc/stdio
parent68a8c771724d4fc671cac3ce95f78d4fb1874cfe (diff)
downloadFreeBSD-src-bfe73fd683053201c326f9ff2c8e5e0f69cc7fe7.zip
FreeBSD-src-bfe73fd683053201c326f9ff2c8e5e0f69cc7fe7.tar.gz
Replace memory leaking instances of realloc with non-leaking reallocf.
In some cases replace if (a == null) a = malloc(x); else a = realloc(a, x); with simple reallocf(a, x). Per ANSI-C, this is guaranteed to be the same thing. I've been running these on my system here w/o ill effects for some time. However, the CTM-express is at part 6 of 34 for the CAM changes, so I've not been able to do a build world with the CAM in the tree with these changes. Shouldn't impact anything, but...
Diffstat (limited to 'lib/libc/stdio')
-rw-r--r--lib/libc/stdio/asprintf.c4
-rw-r--r--lib/libc/stdio/fvwrite.c4
-rw-r--r--lib/libc/stdio/vasprintf.c4
-rw-r--r--lib/libc/stdio/vfprintf.c4
4 files changed, 8 insertions, 8 deletions
diff --git a/lib/libc/stdio/asprintf.c b/lib/libc/stdio/asprintf.c
index 7a3e39a..43e90a9 100644
--- a/lib/libc/stdio/asprintf.c
+++ b/lib/libc/stdio/asprintf.c
@@ -28,7 +28,7 @@
*/
#if defined(LIBC_RCS) && !defined(lint)
-static char rcsid[] = "$Id: asprintf.c,v 1.3 1997/02/22 15:01:45 peter Exp $";
+static char rcsid[] = "$Id: asprintf.c,v 1.4 1998/07/08 00:44:51 peter Exp $";
#endif /* LIBC_RCS and not lint */
#include <stdio.h>
@@ -71,7 +71,7 @@ asprintf(str, fmt, va_alist)
ret = vfprintf(&f, fmt, ap);
*f._p = '\0';
va_end(ap);
- f._bf._base = realloc(f._bf._base, f._bf._size + 1);
+ f._bf._base = reallocf(f._bf._base, f._bf._size + 1);
if (f._bf._base == NULL) {
errno = ENOMEM;
ret = -1;
diff --git a/lib/libc/stdio/fvwrite.c b/lib/libc/stdio/fvwrite.c
index 75dfca9..9cce8f2 100644
--- a/lib/libc/stdio/fvwrite.c
+++ b/lib/libc/stdio/fvwrite.c
@@ -39,7 +39,7 @@
static char sccsid[] = "@(#)fvwrite.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$Id: fvwrite.c,v 1.7 1997/12/24 23:23:18 ache Exp $";
+ "$Id: fvwrite.c,v 1.8 1998/07/08 00:44:54 peter Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
@@ -123,7 +123,7 @@ __sfvwrite(fp, uio)
fp->_w = len + 128;
fp->_bf._size = blen + len + 128;
fp->_bf._base =
- realloc(fp->_bf._base, fp->_bf._size + 1);
+ reallocf(fp->_bf._base, fp->_bf._size + 1);
if (fp->_bf._base == NULL)
goto err;
fp->_p = fp->_bf._base + blen;
diff --git a/lib/libc/stdio/vasprintf.c b/lib/libc/stdio/vasprintf.c
index 87db4cd..3c509ac 100644
--- a/lib/libc/stdio/vasprintf.c
+++ b/lib/libc/stdio/vasprintf.c
@@ -28,7 +28,7 @@
*/
#if defined(LIBC_RCS) && !defined(lint)
-static char rcsid[] = "$Id: vasprintf.c,v 1.8 1998/03/09 06:51:23 jb Exp $";
+static char rcsid[] = "$Id: vasprintf.c,v 1.9 1998/07/08 00:44:56 peter Exp $";
#endif /* LIBC_RCS and not lint */
#include <stdio.h>
@@ -55,7 +55,7 @@ vasprintf(str, fmt, ap)
f._bf._size = f._w = 127; /* Leave room for the NULL */
ret = vfprintf(&f, fmt, ap);
*f._p = '\0';
- f._bf._base = realloc(f._bf._base, f._bf._size + 1);
+ f._bf._base = reallocf(f._bf._base, f._bf._size + 1);
if (f._bf._base == NULL) {
errno = ENOMEM;
ret = -1;
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c
index 57022e5..3cb58ed 100644
--- a/lib/libc/stdio/vfprintf.c
+++ b/lib/libc/stdio/vfprintf.c
@@ -39,7 +39,7 @@
static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$Id: vfprintf.c,v 1.18 1998/04/11 07:40:47 jb Exp $";
+ "$Id: vfprintf.c,v 1.19 1998/05/08 05:10:32 jb Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -1182,7 +1182,7 @@ __grow_type_table (nextarg, typetable, tablesize)
bcopy (oldtable, *typetable, *tablesize);
} else {
*typetable = (unsigned char *)
- realloc (typetable, sizeof (unsigned char) * newsize);
+ reallocf (typetable, sizeof (unsigned char) * newsize);
}
memset (&typetable [*tablesize], T_UNUSED, (newsize - *tablesize));
OpenPOWER on IntegriCloud