shithub: sox

Download patch

ref: 104dc19dc3fb0e6fd367e9820c06608f1d590eac
parent: ffd8837b861f7a9853adead235204b6623cc5742
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
@@ -288,6 +288,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...]",
@@ -297,7 +306,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)