On 09/11/20 20:40, Markus Armbruster wrote:
+ p = get_opt_name_value(p, firstname, help_wanted, &option, &value);
+ if (help_wanted && *help_wanted) {
+ return false;
Doesn't this leak @option and @value? Remember, [2]
get_opt_name_value() always sets *name and *value.
Yes, it does. :(
if (help_wanted) {
qemu_opts_print_help(list, true);
- error_free(err);
} else {
error_report_err(err);
}
I think we could pass &help_wanted unconditionally, then ignore the
value of help_wanted if opts_accepts_any().
Unfortunately not, because callers rely on "help" being added to the
options for !opts_accepts_any. opts_do_parse however does:
+ if (help_wanted && *help_wanted) {
+ return false;
+ }
You made the same remark on the previous version, but unfortunately I
couldn't make it actually produce simpler code.
Paolo