shithub: sox

Download patch

ref: 985b1f4df599e890bd7a02403918294fd95be8b9
parent: 43177ac5f60e96d7036ae0c4121cc51bf490d35f
author: Eric Wong <normalperson@yhbt.net>
date: Sat Jun 9 05:21:53 EDT 2012

ladspa: free memory allocated for control ports

This memory is allocated during the getopts function and
needs to be freed to avoid memory leaks in long-running
libsox-based processes.

--- a/src/ladspa.c
+++ b/src/ladspa.c
@@ -289,6 +289,15 @@
   return SOX_SUCCESS;
 }
 
+static int sox_ladspa_kill(sox_effect_t * effp)
+{
+  priv_t * l_st = (priv_t *)effp->priv;
+
+  free(l_st->control);
+
+  return SOX_SUCCESS;
+}
+
 static sox_effect_handler_t sox_ladspa_effect = {
   "ladspa",
   "MODULE [PLUGIN] [ARGUMENT...]",
@@ -298,7 +307,8 @@
   sox_ladspa_flow,
   sox_ladspa_drain,
   sox_ladspa_stop,
-  NULL, sizeof(priv_t)
+  sox_ladspa_kill,
+  sizeof(priv_t)
 };
 
 const sox_effect_handler_t *lsx_ladspa_effect_fn(void)