From 3c7251ee7889a9eb7d71d4fcb48dc5474a19fc05 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 2 Oct 2004 01:42:06 +0000 Subject: r2773: allow zero sized array talloc (This used to be commit 06c58ad221ec40e46310e847ebf640bd53e8e468) --- source4/lib/talloc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source4/lib/talloc.c b/source4/lib/talloc.c index 9d8caeb0e7..4032039142 100644 --- a/source4/lib/talloc.c +++ b/source4/lib/talloc.c @@ -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); -- cgit