Subject: lib/3448: malloc.c contains bogus preprocessor assumptions
To: None <gnats-bugs@gnats.netbsd.org>
From: Bill Sommerfeld <sommerfeld@orchard.east-arlington.ma.us>
List: netbsd-bugs
Date: 04/04/1997 05:55:13
>Number: 3448
>Category: lib
>Synopsis: malloc.c contains bogus preprocessor assumptions
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: lib-bug-people (Library Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Apr 3 22:05:01 1997
>Last-Modified:
>Originator: Bill Sommerfeld
>Organization:
none
>Release: 970325 or so
>Environment:
System: NetBSD orchard.east-arlington.ma.us 1.2C NetBSD 1.2C (ORCHARD) #19: Thu Mar 27 20:21:43 EST 1997 root@orchard.east-arlington.ma.us:/home/inet6/src/sys/compile/ORCHARD i386
>Description:
malloc contains the following code which assumes a non-ANSI preprocessor:
#define ASSERT(p) if (!(p)) botch("p")
>How-To-Repeat:
Compile malloc with -DDEBUG to let it catch attempts to free
non-malloced memory.
Actually, the two checks enabled by -DDEBUG are sufficiently
useful that I don't understand why we run without them by
default.
They catch:
Attempts to allocate "big, FLUFFY" chunks of memory
(malloc(x) where ((signed)x) < 0).
free(x) where x wasn't previously returned from
malloc.
>Fix:
if __STDC__, s/"p"/#p/
or just give up on non-ANSI compilers.
- Bill
>Audit-Trail:
>Unformatted: