1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-04 05:18:06 +03:00

r2773: allow zero sized array talloc

(This used to be commit 06c58ad221)
This commit is contained in:
Andrew Tridgell 2004-10-02 01:42:06 +00:00 committed by Gerald (Jerry) Carter
parent cc2da2ad67
commit 3c7251ee78

View File

@ -880,8 +880,7 @@ char *talloc_asprintf_append(char *s, const char *fmt, ...)
*/
void *talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name)
{
if (count == 0 ||
count >= MAX_TALLOC_SIZE/el_size) {
if (count >= MAX_TALLOC_SIZE/el_size) {
return NULL;
}
return talloc_named_const(ctx, el_size * count, name);
@ -893,8 +892,7 @@ void *talloc_array(const void *ctx, size_t el_size, unsigned count, const char *
*/
void *talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name)
{
if (count == 0 ||
count >= MAX_TALLOC_SIZE/el_size) {
if (count >= MAX_TALLOC_SIZE/el_size) {
return NULL;
}
ptr = talloc_realloc(ctx, ptr, el_size * count);