diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2019-08-19 13:08:29 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-19 13:08:29 -0500 |
commit | 98bdde643af6443d68a8c6233807b75bd3f0ed80 (patch) | |
tree | 1a09d526baa152b6766b0252cbf2d7e5d1cdda00 /numpy/f2py/src/fortranobject.c | |
parent | e2b5f60e6881a57f53bb6051b4555917d1e05fa7 (diff) | |
parent | 4ada0641ed1a50a2473f8061f4808b4b0d68eff5 (diff) | |
download | numpy-98bdde643af6443d68a8c6233807b75bd3f0ed80.tar.gz |
Merge pull request #14217 from superbobry/fix-f2py-leak
BUG: Fixed a leak in the f2py-generated module initialization code
Diffstat (limited to 'numpy/f2py/src/fortranobject.c')
-rw-r--r-- | numpy/f2py/src/fortranobject.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/numpy/f2py/src/fortranobject.c b/numpy/f2py/src/fortranobject.c index 4a981bf55..b55385b50 100644 --- a/numpy/f2py/src/fortranobject.c +++ b/numpy/f2py/src/fortranobject.c @@ -80,7 +80,10 @@ PyFortranObject_NewAsAttr(FortranDataDef* defs) { /* used for calling F90 module PyFortranObject *fp = NULL; fp = PyObject_New(PyFortranObject, &PyFortran_Type); if (fp == NULL) return NULL; - if ((fp->dict = PyDict_New())==NULL) return NULL; + if ((fp->dict = PyDict_New())==NULL) { + PyObject_Del(fp); + return NULL; + } fp->len = 1; fp->defs = defs; return (PyObject *)fp; @@ -91,7 +94,7 @@ PyFortranObject_NewAsAttr(FortranDataDef* defs) { /* used for calling F90 module static void fortran_dealloc(PyFortranObject *fp) { Py_XDECREF(fp->dict); - PyMem_Del(fp); + PyObject_Del(fp); } |