1
mirror of https://github.com/mpv-player/mpv synced 2024-08-28 05:46:13 +02:00

tv: Zero-out newly-allocated handle in tv_new_handle()

Some fields (notably tv_channel_list) were left uninitialized,
potentially causing problems later on.

Fixes #4096
This commit is contained in:
Frédéric Brière 2017-02-03 12:57:47 -05:00 committed by wm4
parent 8362577f8c
commit aaad2d847e

View File

@ -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;
@ -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;
}