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>
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);
return 0;
fail:
- pa_modargs_free(ma);
+ if (ma)
+ pa_modargs_free(ma);
return -1;
}
return 0;
fail:
- pa_modargs_free(ma);
+ if (ma)
+ pa_modargs_free(ma);
pa__done(m);
return -1;
}