From aa2eb1ee498a25bfc4db5dde9cd4416f059574c0 Mon Sep 17 00:00:00 2001 From: Fabrice Desclaux Date: Sun, 1 Nov 2015 23:09:15 +0100 Subject: JitTcc: fix memory leak --- miasm2/jitter/Jittcc.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'miasm2') 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 -- cgit 1.4.1