diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libc/stdlib/malloc.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 4e88f1a2a9..b6762298a1 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | #if defined(LIBC_SCCS) && !defined(lint) | 10 | #if defined(LIBC_SCCS) && !defined(lint) |
| 11 | static char rcsid[] = "$OpenBSD: malloc.c,v 1.61 2003/09/30 00:22:03 tedu Exp $"; | 11 | static char rcsid[] = "$OpenBSD: malloc.c,v 1.62 2003/10/02 00:02:10 tedu Exp $"; |
| 12 | #endif /* LIBC_SCCS and not lint */ | 12 | #endif /* LIBC_SCCS and not lint */ |
| 13 | 13 | ||
| 14 | /* | 14 | /* |
| @@ -1211,12 +1211,13 @@ malloc(size_t size) | |||
| 1211 | { | 1211 | { |
| 1212 | void *r; | 1212 | void *r; |
| 1213 | 1213 | ||
| 1214 | malloc_func = " in malloc():"; | ||
| 1215 | _MALLOC_LOCK(); | 1214 | _MALLOC_LOCK(); |
| 1215 | malloc_func = " in malloc():"; | ||
| 1216 | if (malloc_active++) { | 1216 | if (malloc_active++) { |
| 1217 | wrtwarning("recursive call\n"); | 1217 | wrtwarning("recursive call\n"); |
| 1218 | malloc_active--; | 1218 | malloc_active--; |
| 1219 | _MALLOC_UNLOCK(); | 1219 | _MALLOC_UNLOCK(); |
| 1220 | errno = EDEADLK; | ||
| 1220 | return (NULL); | 1221 | return (NULL); |
| 1221 | } | 1222 | } |
| 1222 | r = imalloc(size); | 1223 | r = imalloc(size); |
| @@ -1231,12 +1232,13 @@ malloc(size_t size) | |||
| 1231 | void | 1232 | void |
| 1232 | free(void *ptr) | 1233 | free(void *ptr) |
| 1233 | { | 1234 | { |
| 1234 | malloc_func = " in free():"; | ||
| 1235 | _MALLOC_LOCK(); | 1235 | _MALLOC_LOCK(); |
| 1236 | malloc_func = " in free():"; | ||
| 1236 | if (malloc_active++) { | 1237 | if (malloc_active++) { |
| 1237 | wrtwarning("recursive call\n"); | 1238 | wrtwarning("recursive call\n"); |
| 1238 | malloc_active--; | 1239 | malloc_active--; |
| 1239 | _MALLOC_UNLOCK(); | 1240 | _MALLOC_UNLOCK(); |
| 1241 | errno = EDEADLK; | ||
| 1240 | return; | 1242 | return; |
| 1241 | } | 1243 | } |
| 1242 | ifree(ptr); | 1244 | ifree(ptr); |
| @@ -1251,12 +1253,13 @@ realloc(void *ptr, size_t size) | |||
| 1251 | { | 1253 | { |
| 1252 | void *r; | 1254 | void *r; |
| 1253 | 1255 | ||
| 1254 | malloc_func = " in realloc():"; | ||
| 1255 | _MALLOC_LOCK(); | 1256 | _MALLOC_LOCK(); |
| 1257 | malloc_func = " in realloc():"; | ||
| 1256 | if (malloc_active++) { | 1258 | if (malloc_active++) { |
| 1257 | wrtwarning("recursive call\n"); | 1259 | wrtwarning("recursive call\n"); |
| 1258 | malloc_active--; | 1260 | malloc_active--; |
| 1259 | _MALLOC_UNLOCK(); | 1261 | _MALLOC_UNLOCK(); |
| 1262 | errno = EDEADLK; | ||
| 1260 | return (NULL); | 1263 | return (NULL); |
| 1261 | } | 1264 | } |
| 1262 | if (ptr == NULL) { | 1265 | if (ptr == NULL) { |
