diff options
author | Pavel Reichl <preichl@redhat.com> | 2014-09-29 16:40:53 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-10-22 16:40:25 +0200 |
commit | c52d7c41e4127a84f487777c0efa6996f6389c51 (patch) | |
tree | 3ce123cc2fbe4e9a4cb0e643993f1e3af667e5d4 /src/python/pysss.c | |
parent | d3e69c059cb11c735d115a3914dad46806ff46fb (diff) | |
download | sssd-c52d7c41e4127a84f487777c0efa6996f6389c51.tar.gz sssd-c52d7c41e4127a84f487777c0efa6996f6389c51.tar.xz sssd-c52d7c41e4127a84f487777c0efa6996f6389c51.zip |
pyhbac,pysss: fix reference leaks
Resolves:
https://fedorahosted.org/sssd/ticket/1195
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
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; } /* |