# HG changeset patch # User mas01mc # Date 1290267178 0 # Node ID fbf16508421f566626d0c9f72567f25a079d39e8 # Parent 91719fa0d45b11a28e20bcd51db22b7f05417402 Removed potential memory leak in _pyadb_retrieveDatum diff -r 91719fa0d45b -r fbf16508421f bindings/python/pyadbmodule.c --- 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; }