]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ldb: Check talloc_zero_array() return value
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Thu, 6 Jul 2023 22:42:38 +0000 (10:42 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 8 Aug 2023 04:39:37 +0000 (04:39 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/pyldb.c

index 8d38ed83fc9c150636b172311ee986b3a2781769..25c7bb17f41196f196f464450b8d82c33275128e 100644 (file)
@@ -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)) {