summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2015-01-29 08:10:36 +0100
committerJakub Hrozek <jhrozek@redhat.com>2015-01-30 11:35:06 +0100
commit8e0766215aef902eec24d880fbf2b30686c452e6 (patch)
tree4659af84b611a41d95f0a98bec8e4bf221a3dafe
parent31dd2a8c5042493b24ef4f9360139525c018bcb4 (diff)
downloadsssd-8e0766215aef902eec24d880fbf2b30686c452e6.tar.gz
sssd-8e0766215aef902eec24d880fbf2b30686c452e6.tar.xz
sssd-8e0766215aef902eec24d880fbf2b30686c452e6.zip
pysss: Fix double free
The talloc context is removed in destructor. ==1695== Invalid read of size 4 ==1695== at 0x1243D0CD: talloc_chunk_from_ptr (talloc.c:372) ==1695== by 0x1243D0CD: _talloc_free (talloc.c:1559) ==1695== by 0x117B18C3: PySssLocalObject_dealloc (pysss.c:836) ==1695== by 0x117B1AEE: PySssLocalObject_new (pysss.c:898) ==1695== by 0x4ED5522: type_call (typeobject.c:729) ==1695== by 0x4E7F902: PyObject_Call (abstract.c:2529) ==1695== by 0x4F15584: do_call (ceval.c:4328) ==1695== by 0x4F15584: call_function (ceval.c:4133) ==1695== by 0x4F15584: PyEval_EvalFrameEx (ceval.c:2753) ==1695== by 0x4F16BE5: fast_function (ceval.c:4196) ==1695== by 0x4F16BE5: call_function (ceval.c:4131) ==1695== by 0x4F16BE5: PyEval_EvalFrameEx (ceval.c:2753) ==1695== by 0x4F183FF: PyEval_EvalCodeEx (ceval.c:3342) ==1695== by 0x4EA46BC: function_call (funcobject.c:526) ==1695== by 0x4E7F902: PyObject_Call (abstract.c:2529) ==1695== by 0x4F1504F: ext_do_call (ceval.c:4423) ==1695== by 0x4F1504F: PyEval_EvalFrameEx (ceval.c:2792) ==1695== by 0x4F183FF: PyEval_EvalCodeEx (ceval.c:3342) ==1695== Address 0x112d4560 is 64 bytes inside a block of size 96 free'd ==1695== at 0x4C2ACE9: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==1695== by 0x1243D2F2: _talloc_free_internal (talloc.c:1057) ==1695== by 0x1243D2F2: _talloc_free (talloc.c:1581) ==1695== by 0x117B1ABF: PySssLocalObject_new (pysss.c:876) ==1695== by 0x4ED5522: type_call (typeobject.c:729) ==1695== by 0x4E7F902: PyObject_Call (abstract.c:2529) ==1695== by 0x4F15584: do_call (ceval.c:4328) ==1695== by 0x4F15584: call_function (ceval.c:4133) ==1695== by 0x4F15584: PyEval_EvalFrameEx (ceval.c:2753) ==1695== by 0x4F16BE5: fast_function (ceval.c:4196) ==1695== by 0x4F16BE5: call_function (ceval.c:4131) ==1695== by 0x4F16BE5: PyEval_EvalFrameEx (ceval.c:2753) ==1695== by 0x4F183FF: PyEval_EvalCodeEx (ceval.c:3342) ==1695== by 0x4EA46BC: function_call (funcobject.c:526) ==1695== by 0x4E7F902: PyObject_Call (abstract.c:2529) ==1695== by 0x4F1504F: ext_do_call (ceval.c:4423) ==1695== by 0x4F1504F: PyEval_EvalFrameEx (ceval.c:2792) ==1695== by 0x4F183FF: PyEval_EvalCodeEx (ceval.c:3342) Reviewed-by: Pavel Reichl <preichl@redhat.com> (cherry picked from commit 3cd7275c3c41a03eb65769c2bf4e472d1de7b8c0)
-rw-r--r--src/python/pysss.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/src/python/pysss.c b/src/python/pysss.c
index 9e899f139..17e3c19f3 100644
--- a/src/python/pysss.c
+++ b/src/python/pysss.c
@@ -848,7 +848,6 @@ static PyObject *PySssLocalObject_new(PyTypeObject *type,
confdb_path = talloc_asprintf(self->mem_ctx, "%s/%s", DB_PATH, CONFDB_FILE);
if (confdb_path == NULL) {
- talloc_free(mem_ctx);
PyErr_NoMemory();
goto fail;
}
@@ -856,7 +855,6 @@ static PyObject *PySssLocalObject_new(PyTypeObject *type,
/* Connect to the conf db */
ret = confdb_init(self->mem_ctx, &self->confdb, confdb_path);
if (ret != EOK) {
- talloc_free(mem_ctx);
PyErr_SetSssErrorWithMessage(ret,
"Could not initialize connection to the confdb\n");
goto fail;
@@ -865,7 +863,6 @@ static PyObject *PySssLocalObject_new(PyTypeObject *type,
ret = sssd_domain_init(self->mem_ctx, self->confdb, "local",
DB_PATH, &self->local);
if (ret != EOK) {
- talloc_free(mem_ctx);
PyErr_SetSssErrorWithMessage(ret,
"Could not initialize connection to the sysdb\n");
goto fail;