Add simple reference-counted string allocator and use it for passing
around references to the sudoers path. This lets us avoid making copies of the sudoers path for the errorfile as well as each Defaults entry.
This commit is contained in:
@@ -1030,8 +1030,8 @@ export_sudoers(const char *sudoers_path, const char *export_path,
|
||||
if (!quiet)
|
||||
sudo_warnx(U_("failed to parse %s file, unknown error"), sudoers_path);
|
||||
parse_error = true;
|
||||
free(errorfile);
|
||||
if ((errorfile = strdup(sudoers_path)) == NULL)
|
||||
rcstr_delref(errorfile);
|
||||
if ((errorfile = rcstr_dup(sudoers_path)) == NULL)
|
||||
sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||
}
|
||||
ret = !parse_error;
|
||||
|
Reference in New Issue
Block a user