mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
If 'VX' is given, realloc(foo,0) will bail, it shouldn't.
PR: 29376 Submitted by: Farooq Mela <fmela0@sm.socccd.cc.ca.us>
This commit is contained in:
parent
b1e4abd246
commit
7224d02a0d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=86488
@ -1128,7 +1128,8 @@ free(void *ptr)
|
||||
void *
|
||||
realloc(void *ptr, size_t size)
|
||||
{
|
||||
register void *r;
|
||||
void *r;
|
||||
int err = 0;
|
||||
|
||||
THREAD_LOCK();
|
||||
malloc_func = " in realloc():";
|
||||
@ -1154,13 +1155,15 @@ realloc(void *ptr, size_t size)
|
||||
r = ZEROSIZEPTR;
|
||||
} else if (!ptr) {
|
||||
r = imalloc(size);
|
||||
err = (r == NULL);
|
||||
} else {
|
||||
r = irealloc(ptr, size);
|
||||
err = (r == NULL);
|
||||
}
|
||||
UTRACE(ptr, size, r);
|
||||
malloc_active--;
|
||||
THREAD_UNLOCK();
|
||||
if (malloc_xmalloc && !r)
|
||||
if (malloc_xmalloc && err)
|
||||
wrterror("out of memory\n");
|
||||
return (r);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user