From: David van Moolenbroek Date: Fri, 17 Aug 2012 16:53:59 +0000 (+0000) Subject: libaudiodriver: properly deallocate memory X-Git-Tag: v3.2.1~360 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/doxygen.png?a=commitdiff_plain;h=201031fb388b04532a885704fa0f6bbcac927d69;p=minix.git libaudiodriver: properly deallocate memory --- diff --git a/lib/libaudiodriver/audio_fw.c b/lib/libaudiodriver/audio_fw.c index d471abde8..5b9ea47e3 100644 --- a/lib/libaudiodriver/audio_fw.c +++ b/lib/libaudiodriver/audio_fw.c @@ -419,6 +419,7 @@ static int msg_close(int minor_dev_nr) { static int close_sub_dev(int sub_dev_nr) { + size_t size; sub_dev_t *sub_dev_ptr; sub_dev_ptr = &sub_dev[sub_dev_nr]; if (sub_dev_ptr->DmaMode == DEV_WRITE_S && !sub_dev_ptr->OutOfData) { @@ -436,7 +437,8 @@ static int close_sub_dev(int sub_dev_nr) { /* stop the device */ drv_stop(sub_dev_ptr->Nr); /* free the buffers */ - free(sub_dev_ptr->DmaBuf); + size= sub_dev_ptr->DmaSize + 64 * 1024; + free_contig(sub_dev_ptr->DmaBuf, size); free(sub_dev_ptr->ExtraBuf); return OK; }