]> Zhao Yanbai Git Server - minix.git/commitdiff
libaudiodriver: properly deallocate memory
authorDavid van Moolenbroek <david@minix3.org>
Fri, 17 Aug 2012 16:53:59 +0000 (16:53 +0000)
committerDavid van Moolenbroek <david@minix3.org>
Fri, 24 Aug 2012 09:17:27 +0000 (09:17 +0000)
lib/libaudiodriver/audio_fw.c

index d471abde80328127da90a3eb1a564574a930bd49..5b9ea47e33b8ac24785368c962e31435f45a65d0 100644 (file)
@@ -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;
 }