mirror of
https://github.com/samba-team/samba.git
synced 2025-12-16 00:23:52 +03:00
talloc returns 0xdeadbeef when asked to allocate 0 bytes
jerry
This commit is contained in:
@@ -56,6 +56,14 @@ void *talloc(TALLOC_CTX *t, size_t size)
|
|||||||
{
|
{
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
|
if (size == 0)
|
||||||
|
{
|
||||||
|
/* debugging value used to track down
|
||||||
|
memory problems */
|
||||||
|
p = (void*)0xdeadbeef;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
size = (size + (TALLOC_ALIGN-1)) & ~(TALLOC_ALIGN-1);
|
size = (size + (TALLOC_ALIGN-1)) & ~(TALLOC_ALIGN-1);
|
||||||
|
|
||||||
if (!t->list || (t->list->total_size - t->list->alloc_size) < size) {
|
if (!t->list || (t->list->total_size - t->list->alloc_size) < size) {
|
||||||
@@ -77,6 +85,8 @@ void *talloc(TALLOC_CTX *t, size_t size)
|
|||||||
|
|
||||||
p = ((char *)t->list->ptr) + t->list->alloc_size;
|
p = ((char *)t->list->ptr) + t->list->alloc_size;
|
||||||
t->list->alloc_size += size;
|
t->list->alloc_size += size;
|
||||||
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user