summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff VanOss <vanossj@gmail.com>2018-09-27 09:58:47 -0400
committerJeff VanOss <vanossj@gmail.com>2018-09-27 09:58:47 -0400
commit78ac0ed8c6b8e4006c62d6bc68e41cdd438fe4e5 (patch)
tree30858aa2c759dd85a8f92d699de655dab9e20432
parent1109ad0187ed684a8516fe0a595a851a3d7ce305 (diff)
downloadnumpy-78ac0ed8c6b8e4006c62d6bc68e41cdd438fe4e5.tar.gz
BUG: fix memory leak of buffer format string
-rw-r--r--numpy/core/src/multiarray/buffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/buffer.c b/numpy/core/src/multiarray/buffer.c
index 0b15db5f4..46c5e1352 100644
--- a/numpy/core/src/multiarray/buffer.c
+++ b/numpy/core/src/multiarray/buffer.c
@@ -560,7 +560,6 @@ _buffer_info_new(PyObject *obj)
err = _buffer_format_string(descr, &fmt, obj, NULL, NULL);
Py_DECREF(descr);
if (err != 0) {
- free(fmt.s);
goto fail;
}
if (_append_char(&fmt, '\0') < 0) {
@@ -571,6 +570,7 @@ _buffer_info_new(PyObject *obj)
return info;
fail:
+ free(fmt.s);
free(info);
return NULL;
}