diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2015-11-01 23:09:15 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2015-11-01 23:09:15 +0100 |
| commit | aa2eb1ee498a25bfc4db5dde9cd4416f059574c0 (patch) | |
| tree | ae2c312b98ceda997e080b0ba65e44d68df13ace | |
| parent | 9d23ef12b2c41c1c826e1108dd11e651d12a473e (diff) | |
| download | miasm-aa2eb1ee498a25bfc4db5dde9cd4416f059574c0.tar.gz miasm-aa2eb1ee498a25bfc4db5dde9cd4416f059574c0.zip | |
JitTcc: fix memory leak
| -rw-r--r-- | miasm2/jitter/Jittcc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/miasm2/jitter/Jittcc.c b/miasm2/jitter/Jittcc.c index a2102609..a162c41b 100644 --- a/miasm2/jitter/Jittcc.c +++ b/miasm2/jitter/Jittcc.c @@ -141,6 +141,9 @@ PyObject* tcc_exec_bloc(PyObject* self, PyObject* args) if (!PyArg_ParseTuple(args, "OOOO", &retaddr, &jitcpu, &lbl2ptr, &breakpoints)) return NULL; + /* The loop will decref retaddr always once */ + Py_INCREF(retaddr); + for (;;) { // Init BlockDst.is_local = 0; @@ -161,6 +164,7 @@ PyObject* tcc_exec_bloc(PyObject* self, PyObject* args) // Execute it status = func(&BlockDst, jitcpu); + Py_DECREF(retaddr); retaddr = PyLong_FromUnsignedLongLong(BlockDst.address); // Check exception |