ref: 2b5cc07f8b23ede7ba9b240155a7869f491d192f
parent: 57eec584f0ed0150c7ce24b47e425667094cf621
author: robs <robs>
date: Wed Sep 24 17:44:28 EDT 2008
revert to fix double free crash
--- a/src/effects.c
+++ b/src/effects.c
@@ -399,19 +399,16 @@
*/
void sox_delete_effect(sox_effect_t *effp)
{
- size_t clips;
- unsigned f;
+ size_t clips;
+ unsigned f;
- if ((clips = sox_stop_effect(effp)) != 0)
- sox_warn("%s clipped %lu samples; decrease volume?",
- effp->handler.name, (unsigned long)clips);
- for (f = 0; f < effp->flows; ++f)
- {
- effp[f].handler.kill(&effp[f]);
- free(effp[f].priv);
- }
- free(effp);
-
+ if ((clips = sox_stop_effect(effp)) != 0)
+ sox_warn("%s clipped %lu samples; decrease volume?",
+ effp->handler.name, (unsigned long)clips);
+ effp->handler.kill(effp); /* N.B. only one kill; not one per flow */
+ for (f = 0; f < effp->flows; ++f)
+ free(effp[f].priv);
+ free(effp);
}
void sox_delete_effect_last(sox_effects_chain_t *chain)