diff options
| author | Pierre Lalet <pierre@droids-corp.org> | 2015-11-02 09:07:27 +0100 |
|---|---|---|
| committer | Pierre Lalet <pierre@droids-corp.org> | 2015-11-02 09:07:27 +0100 |
| commit | ecb48bb8a993e72b96d84fe09f81bbdc0c513fbc (patch) | |
| tree | ae2c312b98ceda997e080b0ba65e44d68df13ace | |
| parent | 9d23ef12b2c41c1c826e1108dd11e651d12a473e (diff) | |
| parent | aa2eb1ee498a25bfc4db5dde9cd4416f059574c0 (diff) | |
| download | miasm-ecb48bb8a993e72b96d84fe09f81bbdc0c513fbc.tar.gz miasm-ecb48bb8a993e72b96d84fe09f81bbdc0c513fbc.zip | |
Merge pull request #252 from serpilliere/fix_jitloop
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 |