mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +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 *
|
void *
|
||||||
realloc(void *ptr, size_t size)
|
realloc(void *ptr, size_t size)
|
||||||
{
|
{
|
||||||
register void *r;
|
void *r;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
THREAD_LOCK();
|
THREAD_LOCK();
|
||||||
malloc_func = " in realloc():";
|
malloc_func = " in realloc():";
|
||||||
@ -1154,13 +1155,15 @@ realloc(void *ptr, size_t size)
|
|||||||
r = ZEROSIZEPTR;
|
r = ZEROSIZEPTR;
|
||||||
} else if (!ptr) {
|
} else if (!ptr) {
|
||||||
r = imalloc(size);
|
r = imalloc(size);
|
||||||
|
err = (r == NULL);
|
||||||
} else {
|
} else {
|
||||||
r = irealloc(ptr, size);
|
r = irealloc(ptr, size);
|
||||||
|
err = (r == NULL);
|
||||||
}
|
}
|
||||||
UTRACE(ptr, size, r);
|
UTRACE(ptr, size, r);
|
||||||
malloc_active--;
|
malloc_active--;
|
||||||
THREAD_UNLOCK();
|
THREAD_UNLOCK();
|
||||||
if (malloc_xmalloc && !r)
|
if (malloc_xmalloc && err)
|
||||||
wrterror("out of memory\n");
|
wrterror("out of memory\n");
|
||||||
return (r);
|
return (r);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user