Skip to content

Commit

Permalink
tv: Zero-out newly-allocated handle in tv_new_handle()
Browse files Browse the repository at this point in the history
Some fields (notably tv_channel_list) were left uninitialized,
potentially causing problems later on.

Fixes #4096
  • Loading branch information
fbriere authored and wm4 committed Feb 5, 2017
1 parent 8362577 commit aaad2d8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions stream/tv.c
Expand Up @@ -145,7 +145,7 @@ const struct m_sub_options tv_params_conf = {

tvi_handle_t *tv_new_handle(int size, struct mp_log *log, const tvi_functions_t *functions)
{
tvi_handle_t *h = malloc(sizeof(*h));
tvi_handle_t *h = calloc(1, sizeof(*h));

if (!h)
return NULL;
Expand All @@ -159,12 +159,9 @@ tvi_handle_t *tv_new_handle(int size, struct mp_log *log, const tvi_functions_t

h->log = log;
h->functions = functions;
h->seq = 0;
h->chanlist = -1;
h->chanlist_s = NULL;
h->norm = -1;
h->channel = -1;
h->scan = NULL;

return h;
}
Expand Down

0 comments on commit aaad2d8

Please sign in to comment.