From: Joseph Sutton Date: Thu, 6 Jul 2023 22:42:38 +0000 (+1200) Subject: ldb: Check talloc_zero_array() return value X-Git-Tag: tevent-0.16.0~1182 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=229d270deb0ab74101dcc0cbee09edfbe8578dec;p=thirdparty%2Fsamba.git ldb: Check talloc_zero_array() return value Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index 8d38ed83fc9..25c7bb17f41 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -1392,6 +1392,11 @@ static struct ldb_message *PyDict_AsMessage(TALLOC_CTX *mem_ctx, return NULL; } msg->elements = talloc_zero_array(msg, struct ldb_message_element, PyDict_Size(py_obj)); + if (msg->elements == NULL) { + PyErr_NoMemory(); + TALLOC_FREE(msg); + return NULL; + } if (dn_value) { if (!pyldb_Object_AsDn(msg, dn_value, ldb_ctx, &msg->dn)) {