From 8f2a61c2a051deb4396c235dc83fd2ceccda14eb Mon Sep 17 00:00:00 2001
From: Michael Smith <msmith@xiph.org>
Date: Wed, 28 Feb 2001 07:50:12 +0000
Subject: [PATCH] Fix the really obvious errors found in various places trying
 to track down the arts bug.  - wrong function prototypes in ao_null and
 ao_wav  - freeing stuff based on wrong tests in audio_out.c  - fix a memory
 leak in ao_arts.c

git-svn-id: http://svn.xiph.org/trunk/ao@1375 0101bb08-14d6-0310-b084-bc0e0c8e3800
---
 src/ao_null.c              | 2 +-
 src/ao_wav.c               | 2 +-
 src/audio_out.c            | 7 +++++--
 src/plugins/arts/ao_arts.c | 1 +
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/ao_null.c b/src/ao_null.c
index caed4a3..62d6d2c 100644
--- a/src/ao_null.c
+++ b/src/ao_null.c
@@ -73,7 +73,7 @@ static ao_info_t *ao_null_get_driver_info(void)
 	return &ao_null_info;
 }
 
-static int ao_null_get_latency(void)
+static int ao_null_get_latency(ao_internal_t *state)
 {
 	return 0;
 }
diff --git a/src/ao_wav.c b/src/ao_wav.c
index fe0c022..b4172f6 100644
--- a/src/ao_wav.c
+++ b/src/ao_wav.c
@@ -300,7 +300,7 @@ ERR:
 	free(s);
 }
 
-static int ao_wav_get_latency(void)
+static int ao_wav_get_latency(ao_internal_t *state)
 {
 	return 0;
 }
diff --git a/src/audio_out.c b/src/audio_out.c
index b892296..6559749 100644
--- a/src/audio_out.c
+++ b/src/audio_out.c
@@ -161,8 +161,11 @@ void ao_shutdown(void)
 	}
 
 	/* free the standard drivers */
-	if (driver_head->next) free(driver_head->next);
-	if (driver_head->next) free(driver_head);
+	if (driver_head) {
+		if(driver_head->next)
+			free(driver_head->next);
+		free(driver_head);
+	}
 	
 	/* NULL out driver_head or ao_initialize won't work */
 	driver_head = NULL;
diff --git a/src/plugins/arts/ao_arts.c b/src/plugins/arts/ao_arts.c
index ff4b88c..a96a4f4 100644
--- a/src/plugins/arts/ao_arts.c
+++ b/src/plugins/arts/ao_arts.c
@@ -89,6 +89,7 @@ plugin_close(ao_internal_t * state)
 {
   arts_close_stream(((ao_arts_internal_t *)state)->stream);
   arts_free();
+  free(state);
 }
 
   void
-- 
GitLab