diff options
author | 1996-01-29 02:00:21 +0000 | |
---|---|---|
committer | 1996-01-29 02:00:21 +0000 | |
commit | e644c9a233d1c0945ac9f72c7ab61ece82dbe1dd (patch) | |
tree | ba7170e5439105f4e11f94cd8f1540625507471f /lib/libc | |
parent | typo; fix from norijuki soda; netbsd pr#1954 (diff) | |
download | wireguard-openbsd-e644c9a233d1c0945ac9f72c7ab61ece82dbe1dd.tar.xz wireguard-openbsd-e644c9a233d1c0945ac9f72c7ab61ece82dbe1dd.zip |
realloc(ptr, 0) does not free; from seebs@taniemarie.solon.com;
netbsd pr#1806
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/stdlib/malloc.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 3c57fad0243..4498a9fb6c5 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -1,3 +1,5 @@ +/* $NetBSD: malloc.c,v 1.6 1996/01/17 02:45:25 jtc Exp $ */ + /* * Copyright (c) 1983 Regents of the University of California. * All rights reserved. @@ -32,8 +34,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -/*static char *sccsid = "from: @(#)malloc.c 5.11 (Berkeley) 2/23/91";*/ -static char *rcsid = "$Id: malloc.c,v 1.1.1.1 1995/10/18 08:42:18 deraadt Exp $"; +#if 0 +static char *sccsid = "from: @(#)malloc.c 5.11 (Berkeley) 2/23/91"; +#else +static char *rcsid = "$NetBSD: malloc.c,v 1.6 1996/01/17 02:45:25 jtc Exp $"; +#endif #endif /* LIBC_SCCS and not lint */ /* @@ -310,6 +315,10 @@ realloc(cp, nbytes) if (cp == NULL) return (malloc(nbytes)); + if (nbytes == 0) { + free (cp); + return NULL; + } op = (union overhead *)((caddr_t)cp - sizeof (union overhead)); if (op->ov_magic == MAGIC) { was_alloced++; |