In the unmask path, when install_changes_add() fails the borrowed
*name was not handed back via TAKE_PTR() before returning, so
install_info_clear() freed the caller's strv entry, leaving a dangling
pointer that is double-freed at the caller's strv_free().
Follow-up for
f31f10a6207efc9ae9e0b1f73975b5b610914017
path_is_generator(&lp, info.path)) {
r = install_changes_add(changes, n_changes,
INSTALL_CHANGE_IS_MASKED_GENERATOR, info.name, info.path);
- if (r < 0)
+ if (r < 0) {
+ TAKE_PTR(info.name); /* Return the borrowed name before bailing */
return r;
+ }
}
TAKE_PTR(info.name); /* … and give it back here */