git.samba.org
/
kai
/
samba-autobuild
/
.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
pycredentials: Raise MemoryError when unable to create objects.
[kai/samba-autobuild/.git]
/
source4
/
auth
/
credentials
/
pycredentials.c
diff --git
a/source4/auth/credentials/pycredentials.c
b/source4/auth/credentials/pycredentials.c
index 3b119555380d05278e2ed486629820d21751d60a..b0433abeab150d9a7781fea32cb43e7c0117d493 100644
(file)
--- 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)
{
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) {
ret->talloc_ctx = talloc_new(NULL);
if (ret->talloc_ctx == NULL) {
+ PyErr_NoMemory();
return NULL;
}
ret->ptr = cli_credentials_init(ret->talloc_ctx);
return NULL;
}
ret->ptr = cli_credentials_init(ret->talloc_ctx);