mirror of https://github.com/mpv-player/mpv
m_option: fix memory leak on error path
This commit is contained in:
parent
560738ddef
commit
f2e3a49810
|
@ -2027,6 +2027,9 @@ static int get_obj_params(struct bstr opt_name, struct bstr name,
|
||||||
if (r > 0 && ret) {
|
if (r > 0 && ret) {
|
||||||
MP_TARRAY_APPEND(NULL, args, num_args, bstrto0(NULL, fname));
|
MP_TARRAY_APPEND(NULL, args, num_args, bstrto0(NULL, fname));
|
||||||
MP_TARRAY_APPEND(NULL, args, num_args, bstrto0(NULL, fval));
|
MP_TARRAY_APPEND(NULL, args, num_args, bstrto0(NULL, fval));
|
||||||
|
MP_TARRAY_APPEND(NULL, args, num_args, NULL);
|
||||||
|
MP_TARRAY_APPEND(NULL, args, num_args, NULL);
|
||||||
|
num_args -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bstr_eatstart0(pstr, ":"))
|
if (!bstr_eatstart0(pstr, ":"))
|
||||||
|
@ -2035,8 +2038,6 @@ static int get_obj_params(struct bstr opt_name, struct bstr name,
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (num_args > 0) {
|
if (num_args > 0) {
|
||||||
for (int n = 0; n < 2; n++)
|
|
||||||
MP_TARRAY_APPEND(NULL, args, num_args, NULL);
|
|
||||||
*ret = args;
|
*ret = args;
|
||||||
args = NULL;
|
args = NULL;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2051,6 +2052,7 @@ print_help: ;
|
||||||
r = M_OPT_EXIT - 1;
|
r = M_OPT_EXIT - 1;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
free_str_list(&args);
|
||||||
talloc_free(config);
|
talloc_free(config);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue