Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix invalid memory usage in mpegts/iptv, mpegts/tsfile, subscriptions…
…, and tvhtime
  • Loading branch information
KyleSanderson authored and perexg committed Jun 27, 2015
1 parent 2f1277b commit 2b1d80b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/input/mpegts/iptv/iptv_rtsp.c
Expand Up @@ -197,12 +197,14 @@ iptv_rtsp_stop
( iptv_mux_t *im )
{
rtsp_priv_t *rp = im->im_data;
int play = rp->play;
int play;

lock_assert(&global_lock);

if (rp == NULL)
return;

play = rp->play;
im->im_data = NULL;
rp->hc->hc_aux = NULL;
if (play)
Expand Down
7 changes: 5 additions & 2 deletions src/input/mpegts/tsfile/tsfile.c
Expand Up @@ -47,14 +47,17 @@ tsfile_network_create_service
{
pthread_mutex_lock(&tsfile_lock);
mpegts_service_t *s = mpegts_service_create1(NULL, mm, sid, pmt_pid, NULL);
s->s_config_save = tsfile_service_config_save;
pthread_mutex_unlock(&tsfile_lock);

// TODO: HACK: REMOVE ME
if (s) {
s->s_config_save = tsfile_service_config_save;
pthread_mutex_unlock(&tsfile_lock);
channel_t *c = channel_create(NULL, NULL, NULL);
service_mapper_link((service_t*)s, c, NULL);
}
else
pthread_mutex_unlock(&tsfile_lock);

return s;
}

Expand Down
4 changes: 3 additions & 1 deletion src/subscriptions.c
Expand Up @@ -549,13 +549,15 @@ subscription_input(void *opauqe, streaming_message_t *sm)
void
subscription_unsubscribe(th_subscription_t *s, int quiet)
{
service_t *t = s->ths_service;
service_t *t;
char buf[512];
size_t l = 0;

if (s == NULL)
return;

t = s->ths_service;

lock_assert(&global_lock);

s->ths_state = SUBSCRIPTION_ZOMBIE;
Expand Down
3 changes: 2 additions & 1 deletion src/tvhtime.c
Expand Up @@ -67,8 +67,9 @@ ntp_shm_init ( void )
return NULL;

shmptr = shmat(shmid, 0, 0);
memset(shmptr, 0, sizeof(ntp_shm_t));

if (shmptr) {
memset(shmptr, 0, sizeof(ntp_shm_t));
shmptr->mode = 1;
shmptr->precision = -1;
shmptr->nsamples = 1;
Expand Down

0 comments on commit 2b1d80b

Please sign in to comment.