[xiph-commits] r13176 - branches/speex-branches/speex-1.0-branch/src

jm at svn.xiph.org jm at svn.xiph.org
Fri Jun 22 21:15:31 PDT 2007


Author: jm
Date: 2007-06-22 21:15:31 -0700 (Fri, 22 Jun 2007)
New Revision: 13176

Modified:
   branches/speex-branches/speex-1.0-branch/src/speexdec.c
Log:
fixed potential leak


Modified: branches/speex-branches/speex-1.0-branch/src/speexdec.c
===================================================================
--- branches/speex-branches/speex-1.0-branch/src/speexdec.c	2007-06-23 04:08:03 UTC (rev 13175)
+++ branches/speex-branches/speex-1.0-branch/src/speexdec.c	2007-06-23 04:15:31 UTC (rev 13176)
@@ -311,6 +311,7 @@
    {
       fprintf (stderr, "Mode number %d does not (yet/any longer) exist in this version\n", 
                header->mode);
+      free(header);
       return NULL;
    }
       
@@ -323,17 +324,20 @@
    if (header->speex_version_id > 1)
    {
       fprintf (stderr, "This file was encoded with Speex bit-stream version %d, which I don't know how to decode\n", header->speex_version_id);
+      free(header);
       return NULL;
    }
 
    if (mode->bitstream_version < header->mode_bitstream_version)
    {
       fprintf (stderr, "The file was encoded with a newer version of Speex. You need to upgrade in order to play it.\n");
+      free(header);
       return NULL;
    }
    if (mode->bitstream_version > header->mode_bitstream_version) 
    {
       fprintf (stderr, "The file was encoded with an older version of Speex. You would need to downgrade the version in order to play it.\n");
+      free(header);
       return NULL;
    }
    
@@ -341,6 +345,7 @@
    if (!st)
    {
       fprintf (stderr, "Decoder initialization failed.\n");
+      free(header);
       return NULL;
    }
    speex_decoder_ctl(st, SPEEX_SET_ENH, &enh_enabled);



More information about the commits mailing list