diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2024-02-03 18:48:42 +0100 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2024-02-15 16:43:37 +0000 |
commit | 024e49010c32c5840b2c1bd25e4b65f5c4c4a41e (patch) | |
tree | 5dbdc0e6f4f876984edf815929ae6a403233c8c1 /options/m_option.c | |
parent | f413e38e42e64fde91670726f727471359f41077 (diff) | |
download | mpv-024e49010c32c5840b2c1bd25e4b65f5c4c4a41e.tar.bz2 mpv-024e49010c32c5840b2c1bd25e4b65f5c4c4a41e.tar.xz |
m_option: fix memory leak in parse_obj_settings_list
Found by fuzzing.
Diffstat (limited to 'options/m_option.c')
-rw-r--r-- | options/m_option.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/options/m_option.c b/options/m_option.c index 18346d0374..47f9c07883 100644 --- a/options/m_option.c +++ b/options/m_option.c @@ -3404,15 +3404,21 @@ static int parse_obj_settings_list(struct mp_log *log, const m_option_t *opt, if (r == 0) { r = parse_obj_settings(log, name, op, ¶m, ol, dst ? &res : NULL); } - if (r < 0) + if (r < 0) { + free_obj_settings_list(&res); return r; + } if (param.len > 0) { const char sep[2] = {OPTION_LIST_SEPARATOR, 0}; - if (!bstr_eatstart0(¶m, sep)) + if (!bstr_eatstart0(¶m, sep)) { + free_obj_settings_list(&res); return M_OPT_INVALID; + } if (param.len == 0) { - if (!ol->allow_trailer) + if (!ol->allow_trailer) { + free_obj_settings_list(&res); return M_OPT_INVALID; + } if (dst) { m_obj_settings_t item = { .name = talloc_strdup(NULL, ""), @@ -3427,6 +3433,7 @@ static int parse_obj_settings_list(struct mp_log *log, const m_option_t *opt, if (op == OP_APPEND) { mp_err(log, "Option %.*s: -append takes only 1 filter (no ',').\n", BSTR_P(name)); + free_obj_settings_list(&res); return M_OPT_INVALID; } mp_warn(log, "Passing more than 1 argument to %.*s is deprecated!\n", |