mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
bluetooth: Prevent aborts caused by invalid module arguments
If 'pa_modargs_new' returns a NULL, we need to be careful to not call 'pa_modargs_free' in the failure path since it requires that we pass it a non-null argument. Also updates 'module-bluetooth-policy.c:pa__init' to follow the standard "goto fail" pattern used everywhere else. Signed-off-by: Jason Gerecke <killertofu@gmail.com>
This commit is contained in:
parent
f8c69de418
commit
00ba340618
2 changed files with 5 additions and 3 deletions
|
|
@ -225,7 +225,7 @@ int pa__init(pa_module *m) {
|
|||
|
||||
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
|
||||
pa_log_error("Failed to parse module arguments");
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
m->userdata = u = pa_xnew0(struct userdata, 1);
|
||||
|
|
@ -261,7 +261,8 @@ int pa__init(pa_module *m) {
|
|||
return 0;
|
||||
|
||||
fail:
|
||||
pa_modargs_free(ma);
|
||||
if (ma)
|
||||
pa_modargs_free(ma);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,7 +137,8 @@ int pa__init(pa_module *m) {
|
|||
return 0;
|
||||
|
||||
fail:
|
||||
pa_modargs_free(ma);
|
||||
if (ma)
|
||||
pa_modargs_free(ma);
|
||||
pa__done(m);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue