Browse Source

THREAD_UNLOCK() on error before returning; millert@ ok.

OPENBSD_3_1
fgsch 23 years ago
parent
commit
f9ed61c293
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      src/lib/libc/stdlib/malloc.c

+ 3
- 1
src/lib/libc/stdlib/malloc.c View File

@ -8,7 +8,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] = "$OpenBSD: malloc.c,v 1.45 2001/12/05 22:54:01 tdeval Exp $";
static char rcsid[] = "$OpenBSD: malloc.c,v 1.46 2002/01/23 20:42:24 fgsch Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
/* /*
@ -1248,6 +1248,7 @@ malloc(size_t size)
if (malloc_active++) { if (malloc_active++) {
wrtwarning("recursive call.\n"); wrtwarning("recursive call.\n");
malloc_active--; malloc_active--;
THREAD_UNLOCK();
return (0); return (0);
} }
r = imalloc(size); r = imalloc(size);
@ -1287,6 +1288,7 @@ realloc(void *ptr, size_t size)
if (malloc_active++) { if (malloc_active++) {
wrtwarning("recursive call.\n"); wrtwarning("recursive call.\n");
malloc_active--; malloc_active--;
THREAD_UNLOCK();
return (0); return (0);
} }
if (!ptr) { if (!ptr) {


Loading…
Cancel
Save