summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Brière <fbriere@fbriere.net>2017-02-03 12:57:47 -0500
committerwm4 <wm4@nowhere>2017-02-05 14:20:27 +0100
commitaaad2d847e60a5bbd8fbf9c89f100a9ef9abd008 (patch)
tree55a6e8bb695e26f37c06514b985645cf07e738bf
parent8362577f8c44cf447c31ed7f30ce62cce3e95a30 (diff)
downloadmpv-aaad2d847e60a5bbd8fbf9c89f100a9ef9abd008.tar.bz2
mpv-aaad2d847e60a5bbd8fbf9c89f100a9ef9abd008.tar.xz
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
-rw-r--r--stream/tv.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/stream/tv.c b/stream/tv.c
index 0b34b566d8..89783374f9 100644
--- a/stream/tv.c
+++ b/stream/tv.c
@@ -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;
}