changeset 25638:a4c3eb7ef547

Use malloc for codecdata. Fixes segfault in free_sh_sub.
author eugeni
date Thu, 10 Jan 2008 19:47:18 +0000
parents 7c383969fb67
children 8a673cfc4043
files libmpcodecs/ad_faad.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_faad.c	Thu Jan 10 19:21:56 2008 +0000
+++ b/libmpcodecs/ad_faad.c	Thu Jan 10 19:47:18 2008 +0000
@@ -75,7 +75,8 @@
   // If we don't get the ES descriptor, try manual config
   if(!sh->codecdata_len && sh->wf) {
     sh->codecdata_len = sh->wf->cbSize;
-    sh->codecdata = (char*)(sh->wf+1);
+    sh->codecdata = malloc(sh->codecdata_len);
+    memcpy(sh->codecdata, sh->wf+1, sh->codecdata_len);
     mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"FAAD: codecdata extracted from WAVEFORMATEX\n");
   }
   if(!sh->codecdata_len) {