libaudiodriver: properly deallocate memory

This commit is contained in:
David van Moolenbroek 2012-08-17 16:53:59 +00:00
parent 9821bbf780
commit 201031fb38

View file

@ -419,6 +419,7 @@ static int msg_close(int minor_dev_nr) {
static int close_sub_dev(int sub_dev_nr) { static int close_sub_dev(int sub_dev_nr) {
size_t size;
sub_dev_t *sub_dev_ptr; sub_dev_t *sub_dev_ptr;
sub_dev_ptr = &sub_dev[sub_dev_nr]; sub_dev_ptr = &sub_dev[sub_dev_nr];
if (sub_dev_ptr->DmaMode == DEV_WRITE_S && !sub_dev_ptr->OutOfData) { 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 */ /* stop the device */
drv_stop(sub_dev_ptr->Nr); drv_stop(sub_dev_ptr->Nr);
/* free the buffers */ /* 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); free(sub_dev_ptr->ExtraBuf);
return OK; return OK;
} }