diff options
Diffstat (limited to 'src/python/pysss.c')
-rw-r--r-- | src/python/pysss.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/python/pysss.c b/src/python/pysss.c index 8f98f081c..9e899f139 100644 --- a/src/python/pysss.c +++ b/src/python/pysss.c @@ -850,7 +850,7 @@ static PyObject *PySssLocalObject_new(PyTypeObject *type, if (confdb_path == NULL) { talloc_free(mem_ctx); PyErr_NoMemory(); - return NULL; + goto fail; } /* Connect to the conf db */ @@ -859,7 +859,7 @@ static PyObject *PySssLocalObject_new(PyTypeObject *type, talloc_free(mem_ctx); PyErr_SetSssErrorWithMessage(ret, "Could not initialize connection to the confdb\n"); - return NULL; + goto fail; } ret = sssd_domain_init(self->mem_ctx, self->confdb, "local", @@ -868,7 +868,7 @@ static PyObject *PySssLocalObject_new(PyTypeObject *type, talloc_free(mem_ctx); PyErr_SetSssErrorWithMessage(ret, "Could not initialize connection to the sysdb\n"); - return NULL; + goto fail; } self->sysdb = self->local->sysdb; @@ -876,6 +876,10 @@ static PyObject *PySssLocalObject_new(PyTypeObject *type, self->unlock = DO_UNLOCK; return (PyObject *) self; + +fail: + Py_DECREF(self); + return NULL; } /* |