shithub: sox

Download patch

ref: 58f37f1e4acc5ba8e1ff483d4ddf32b9ce7dbd3d
parent: 25263b582955f7ba4086960c4440a22c7aa94921
author: rrt <rrt>
date: Sun Jan 21 14:02:19 EST 2007

Don't leak memory on error

--- a/src/sndfile.c
+++ b/src/sndfile.c
@@ -45,8 +45,11 @@
   sndfile_t sf = (sndfile_t)ft->priv;
 
   sf->sf_info = (SF_INFO *)xcalloc(1, sizeof(SF_INFO));
+  /* We'd like to use sf_open, but auto file typing has already
+     invoked stdio buffering. */
   if ((sf->sf_file = sf_open(ft->filename, SFM_READ, sf->sf_info)) == NULL) {
     st_fail("sndfile cannot open file for reading: %s %x", sf_strerror(sf->sf_file), sf->sf_info->format);
+    free(sf->sf_file);
     return ST_EOF;
   }