Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mpegts input: mm_active cleanups, fix also memory leak introduced by …
…mi_stop
  • Loading branch information
perexg committed Oct 28, 2014
1 parent a4cfbb9 commit 863ea6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/input/mpegts/mpegts_input.c
Expand Up @@ -605,6 +605,8 @@ mpegts_input_recv_packets
if (!mi->mi_stop) {
TAILQ_INSERT_TAIL(&mi->mi_input_queue, mp, mp_link);
pthread_cond_signal(&mi->mi_input_cond);
} else {
free(mp);
}
pthread_mutex_unlock(&mi->mi_input_lock);
}
Expand Down Expand Up @@ -718,6 +720,8 @@ mpegts_input_process
mpegts_mux_instance_t *mmi = mm->mm_active;
mpegts_pid_t *last_mp = NULL;

assert(mmi);

mi->mi_live = 1;

/* Process */
Expand Down
5 changes: 2 additions & 3 deletions src/input/mpegts/mpegts_mux.c
Expand Up @@ -692,9 +692,6 @@ mpegts_mux_stop ( mpegts_mux_t *mm, int force )
/* Stop possible recursion */
if (!mmi) return;

/* Clear */
mm->mm_active = NULL;

mpegts_mux_nice_name(mm, buf, sizeof(buf));
tvhdebug("mpegts", "%s - stopping mux", buf);

Expand All @@ -706,6 +703,8 @@ mpegts_mux_stop ( mpegts_mux_t *mm, int force )
mi->mi_stop_mux(mi, mmi);
mi->mi_stopped_mux(mi, mmi);

assert(mm->mm_active == NULL);

/* Flush all tables */
tvhtrace("mpegts", "%s - flush tables", buf);
mpegts_table_flush_all(mm);
Expand Down

0 comments on commit 863ea6f

Please sign in to comment.