From 1d6562332ef5e9af207c39ceeae3b37dba6da32a Mon Sep 17 00:00:00 2001 From: Adam Sutton Date: Wed, 25 Sep 2013 22:11:58 +0100 Subject: [PATCH] mpegts: actually fix the PID closing crash bug! --- src/input/mpegts/mpegts_input.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/input/mpegts/mpegts_input.c b/src/input/mpegts/mpegts_input.c index 40aa35a8..57e53a2e 100644 --- a/src/input/mpegts/mpegts_input.c +++ b/src/input/mpegts/mpegts_input.c @@ -143,9 +143,9 @@ mpegts_input_open_pid ( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, void *owner ) { char buf[512]; - mpegts_pid_t *mp = mpegts_mux_find_pid(mm, pid, 1); + mpegts_pid_t *mp; assert(owner != NULL); - if (mp) { + if ((mp = mpegts_mux_find_pid(mm, pid, 1))) { static mpegts_pid_sub_t *skel = NULL; if (!skel) skel = calloc(1, sizeof(mpegts_pid_sub_t)); @@ -167,8 +167,10 @@ mpegts_input_close_pid { char buf[512]; mpegts_pid_sub_t *mps, skel; - mpegts_pid_t *mp = mpegts_mux_find_pid(mm, pid, 1); + mpegts_pid_t *mp; assert(owner != NULL); + if (!(mp = mpegts_mux_find_pid(mm, pid, 1))) + return; skel.mps_type = type; skel.mps_owner = owner; mps = RB_FIND(&mp->mp_subs, &skel, mps_link, mps_cmp);