pyldb: Fix CID 1034792 Dereference null return value
authorVolker Lendecke <vl@samba.org>
Sun, 18 Aug 2013 19:51:49 +0000 (19:51 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 18 Aug 2013 23:08:25 +0000 (11:08 +1200)
Add a NULL check

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/pyldb.c

index ec6c7d0e542370b92d33a6078253d4fc96dd457f..45831329009e630420993a31f8216c1c6e1fa18a 100644 (file)
@@ -1075,6 +1075,10 @@ static struct ldb_message *PyDict_AsMessage(TALLOC_CTX *mem_ctx,
        PyObject *dn_value = PyDict_GetItemString(py_obj, "dn");
 
        msg = ldb_msg_new(mem_ctx);
+       if (msg == NULL) {
+               PyErr_NoMemory();
+               return NULL;
+       }
        msg->elements = talloc_zero_array(msg, struct ldb_message_element, PyDict_Size(py_obj));
 
        if (dn_value) {