diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-06-17 19:07:22 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-06-17 20:45:38 +0200 |
commit | 7b8fcacda29954c585746c255598b9b180e56e1f (patch) | |
tree | 9e2c38383e74c3f9c608243a871aef12e9f9f386 | |
parent | 0c16676642a1cb41f889fac02351fc2509dbecaa (diff) | |
download | samba-7b8fcacda29954c585746c255598b9b180e56e1f.tar.gz samba-7b8fcacda29954c585746c255598b9b180e56e1f.tar.bz2 samba-7b8fcacda29954c585746c255598b9b180e56e1f.zip |
pycredentials: Raise MemoryError when unable to create objects.
-rw-r--r-- | source4/auth/credentials/pycredentials.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source4/auth/credentials/pycredentials.c b/source4/auth/credentials/pycredentials.c index 3b11955538..b0433abeab 100644 --- a/source4/auth/credentials/pycredentials.c +++ b/source4/auth/credentials/pycredentials.c @@ -38,9 +38,14 @@ static PyObject *PyString_FromStringOrNULL(const char *str) static PyObject *py_creds_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { - py_talloc_Object *ret = (py_talloc_Object *)PyCredentials.tp_alloc(&PyCredentials, 0); + py_talloc_Object *ret = (py_talloc_Object *)type->tp_alloc(type, 0); + if (ret == NULL) { + PyErr_NoMemory(); + return NULL; + } ret->talloc_ctx = talloc_new(NULL); if (ret->talloc_ctx == NULL) { + PyErr_NoMemory(); return NULL; } ret->ptr = cli_credentials_init(ret->talloc_ctx); |