From: stevenj Date: Thu, 8 Jul 2010 19:04:36 +0000 (-0400) Subject: fix memory leak in python wrapper on exception X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=18b30705a5f0dc30fc24816721db9d9e04012df4;p=nlopt.git fix memory leak in python wrapper on exception darcs-hash:20100708190436-c8de0-0b50fd5776481816285a42d5b06679666377d0ea.gz --- 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)) {