shithub: sox

Download patch

ref: ef624ab558952482058e8fd4444afc1a0a1cdba6
parent: 621b1586820b67ec7b5989f6eef8616c79ba8d86
author: Chris Bagwell <chris@cnpbagwell.com>
date: Sun Mar 4 06:06:47 EST 2012

sox_format_quit() should reset format counts

If an app is calling sox_format_init() and sox_format_quit()
multiple times then count of formats was not correct and
worse there were pointers to unloaded symbols sticking around.

--- a/ChangeLog
+++ b/ChangeLog
@@ -101,6 +101,8 @@
 Other bug fixes:
 
   o Fix several memory leaks. [3309913] (Jin-Myung Won and Ulrich Klauer)
+  o Fixed crashes in apps that call sox_format_init/quit() mujltiple times.
+   (cbagwell)
 
 Internal improvements:
 
--- a/src/formats.c
+++ b/src/formats.c
@@ -1239,6 +1239,8 @@
   int ret;
   if (plugins_initted && (ret = lt_dlexit()) != 0)
     lsx_fail("lt_dlexit failed with %d error(s): %s", ret, lt_dlerror());
+  plugins_initted = sox_false;
+  nformats = NSTATIC_FORMATS;
 #endif
 }