summaryrefslogtreecommitdiffstats
path: root/options/m_property.c
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-10-22 19:38:58 +0200
committersfan5 <sfan5@live.de>2023-10-23 20:33:51 +0200
commit1805681aaba22aa19a27ecfdb639c983d91f83e6 (patch)
tree755dfebed879c474f6f55b5e7b6efbf66b5693c9 /options/m_property.c
parent907443686242dfb9636ac5b604581f484e5fca7f (diff)
downloadmpv-1805681aaba22aa19a27ecfdb639c983d91f83e6.tar.bz2
mpv-1805681aaba22aa19a27ecfdb639c983d91f83e6.tar.xz
m_option: initialize m_option_value union properly
C standard says that `= {0}` activates and initializes first member of union. We expect whole union to be zeroed, it is used as default value. Initialize union with one zeroed default instance to ensure proper init. Fixes: #12711
Diffstat (limited to 'options/m_property.c')
-rw-r--r--options/m_property.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/options/m_property.c b/options/m_property.c
index 7667dd6161..1b76f05e7d 100644
--- a/options/m_property.c
+++ b/options/m_property.c
@@ -38,7 +38,7 @@ static int m_property_multiply(struct mp_log *log,
const struct m_property *prop_list,
const char *property, double f, void *ctx)
{
- union m_option_value val = {0};
+ union m_option_value val = m_option_value_default;
struct m_option opt = {0};
int r;
@@ -98,7 +98,7 @@ static int do_action(const struct m_property *prop_list, const char *name,
int m_property_do(struct mp_log *log, const struct m_property *prop_list,
const char *name, int action, void *arg, void *ctx)
{
- union m_option_value val = {0};
+ union m_option_value val = m_option_value_default;
int r;
struct m_option opt = {0};
@@ -562,7 +562,7 @@ int m_property_read_list(int action, void *arg, int count,
r = get_item(n, M_PROPERTY_GET_TYPE, &opt, ctx);
if (r != M_PROPERTY_OK)
goto err;
- union m_option_value val = {0};
+ union m_option_value val = m_option_value_default;
r = get_item(n, M_PROPERTY_GET, &val, ctx);
if (r != M_PROPERTY_OK)
goto err;