changeset 35254:3828cde710a2

Fix crash in case sh_audio allocation failed.
author reimar
date Mon, 05 Nov 2012 20:51:45 +0000
parents 48db1b241757
children c93bf3f1540b
files libmpdemux/demux_ts.c
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_ts.c	Mon Nov 05 20:45:40 2012 +0000
+++ b/libmpdemux/demux_ts.c	Mon Nov 05 20:51:45 2012 +0000
@@ -360,13 +360,13 @@
 			priv->ts.streams[es->pid].type = TYPE_AUDIO;
 			mp_msg(MSGT_DEMUX, MSGL_V, "\r\nADDED AUDIO PID %d, type: %x stream n. %d\r\n", es->pid, sh->format, priv->last_aid);
 			priv->last_aid++;
-		}
-
-		if(es->extradata && es->extradata_len)
-		{
-			sh->wf = malloc(sizeof(*sh->wf) + es->extradata_len);
-			sh->wf->cbSize = es->extradata_len;
-			memcpy(sh->wf + 1, es->extradata, es->extradata_len);
+
+			if(es->extradata && es->extradata_len)
+			{
+				sh->wf = malloc(sizeof(*sh->wf) + es->extradata_len);
+				sh->wf->cbSize = es->extradata_len;
+				memcpy(sh->wf + 1, es->extradata, es->extradata_len);
+			}
 		}
 	}