From c571413e6563b69c581fcf79dc43d02f809e5fa5 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 18 Sep 2014 11:40:23 +0200 Subject: [PATCH] tsfix: fix the crash caused by last tsfix.c modification (memory leak fix) --- src/plumbing/tsfix.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/plumbing/tsfix.c b/src/plumbing/tsfix.c index 09f69c28..6cfd6a43 100644 --- a/src/plumbing/tsfix.c +++ b/src/plumbing/tsfix.c @@ -259,23 +259,19 @@ recover_pts(tsfix_t *tf, tfstream_t *tfs, th_pkt_t *pkt) case PKT_P_FRAME: /* Presentation occures at DTS of next I or P frame, try to find it */ - srch = TAILQ_NEXT(pr, pr_link); - while(1) { - if(srch == NULL) { - pkt_ref_dec(pkt); - return; /* not arrived yet, wait */ - } - if(tfs_find(tf, srch->pr_pkt) == tfs && - srch->pr_pkt->pkt_frametype <= PKT_P_FRAME) { + TAILQ_FOREACH(srch, &tf->tf_ptsq, pr_link) + if (tfs_find(tf, srch->pr_pkt) == tfs && + srch->pr_pkt->pkt_frametype <= PKT_P_FRAME) { pkt->pkt_pts = srch->pr_pkt->pkt_dts; tsfixprintf("TSFIX: %-12s PTS *-frame set to %"PRId64"\n", streaming_component_type2txt(tfs->tfs_type), pkt->pkt_pts); break; } - srch = TAILQ_NEXT(srch, pr_link); - } - break; + if (srch == NULL) { + pkt_ref_dec(pkt); + return; /* not arrived yet, wait */ + } } break;