Mercurial > hg > audiodb
changeset 747:fbf16508421f
Removed potential memory leak in _pyadb_retrieveDatum
| author | mas01mc |
|---|---|
| date | Sat, 20 Nov 2010 15:32:58 +0000 |
| parents | 91719fa0d45b |
| children | e5f96902afaf 9bd13c7819ae |
| files | bindings/python/pyadbmodule.c |
| diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/bindings/python/pyadbmodule.c Sat Nov 20 15:26:41 2010 +0000 +++ b/bindings/python/pyadbmodule.c Sat Nov 20 15:32:58 2010 +0000 @@ -684,14 +684,16 @@ } outgoing = PyArray_SimpleNewFromData(dims, shape, NPY_DOUBLE, data); + free(status); + free(ins); // free the malloced adb_datum_t structure though + if (!outgoing){ PyErr_SetString(PyExc_TypeError, "Failed to convert retrieved datum to C-Array"); return NULL; } // Apprently Python automatically INCREFs the data pointer, so we don't have to call // audiodb_free_datum(current_db, ins); - free(status); - free(ins); // free the malloced adb_datum_t structure though + return outgoing; }
