comparison bindings/python/pyadbmodule.c @ 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
comparison
equal deleted inserted replaced
746:91719fa0d45b 747:fbf16508421f
682 shape[0]= 2 * ins->nvectors; 682 shape[0]= 2 * ins->nvectors;
683 data = ins->times; 683 data = ins->times;
684 } 684 }
685 685
686 outgoing = PyArray_SimpleNewFromData(dims, shape, NPY_DOUBLE, data); 686 outgoing = PyArray_SimpleNewFromData(dims, shape, NPY_DOUBLE, data);
687 free(status);
688 free(ins); // free the malloced adb_datum_t structure though
689
687 if (!outgoing){ 690 if (!outgoing){
688 PyErr_SetString(PyExc_TypeError, "Failed to convert retrieved datum to C-Array"); 691 PyErr_SetString(PyExc_TypeError, "Failed to convert retrieved datum to C-Array");
689 return NULL; 692 return NULL;
690 } 693 }
691 // Apprently Python automatically INCREFs the data pointer, so we don't have to call 694 // Apprently Python automatically INCREFs the data pointer, so we don't have to call
692 // audiodb_free_datum(current_db, ins); 695 // audiodb_free_datum(current_db, ins);
693 free(status); 696
694 free(ins); // free the malloced adb_datum_t structure though
695 return outgoing; 697 return outgoing;
696 } 698 }
697 699
698 700
699 /* close a database */ 701 /* close a database */