From 18b30705a5f0dc30fc24816721db9d9e04012df4 Mon Sep 17 00:00:00 2001 From: stevenj Date: Thu, 8 Jul 2010 15:04:36 -0400 Subject: [PATCH] fix memory leak in python wrapper on exception darcs-hash:20100708190436-c8de0-0b50fd5776481816285a42d5b06679666377d0ea.gz --- swig/nlopt-python.i | 1 + 1 file changed, 1 insertion(+) diff --git a/swig/nlopt-python.i b/swig/nlopt-python.i index db1967a..83df76f 100644 --- a/swig/nlopt-python.i +++ b/swig/nlopt-python.i @@ -138,6 +138,7 @@ static double func_python(unsigned n, const double *x, double *grad, void *f) double val = HUGE_VAL; if (PyErr_Occurred()) { + Py_XDECREF(result); throw nlopt::forced_stop(); // just stop, don't call PyErr_Clear() } else if (result && PyFloat_Check(result)) { -- 2.30.2