Fix a few memory leaks in the tests.
This commit is contained in:
@@ -74,7 +74,6 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
for (td = test_data; td->input != NULL; td++) {
|
for (td = test_data; td->input != NULL; td++) {
|
||||||
ntests++;
|
ntests++;
|
||||||
free(path);
|
|
||||||
if ((path = strdup(td->input)) == NULL)
|
if ((path = strdup(td->input)) == NULL)
|
||||||
sudo_fatal(NULL);
|
sudo_fatal(NULL);
|
||||||
result = expand_tilde(&path, td->user);
|
result = expand_tilde(&path, td->user);
|
||||||
@@ -86,14 +85,12 @@ main(int argc, char *argv[])
|
|||||||
} else {
|
} else {
|
||||||
sudo_warnx("unexpected failure: input %s", td->input);
|
sudo_warnx("unexpected failure: input %s", td->input);
|
||||||
}
|
}
|
||||||
continue;
|
} else if (td->result && strcmp(path, td->output) != 0) {
|
||||||
}
|
|
||||||
if (td->result && strcmp(path, td->output) != 0) {
|
|
||||||
errors++;
|
errors++;
|
||||||
sudo_warnx("incorrect output for input %s: expected %s, got %s",
|
sudo_warnx("incorrect output for input %s: expected %s, got %s",
|
||||||
td->input, td->output, path);
|
td->input, td->output, path);
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
free(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ntests != 0) {
|
if (ntests != 0) {
|
||||||
|
@@ -295,6 +295,7 @@ main(int argc, char *argv[])
|
|||||||
if (get_net_ifs(&p) > 0) {
|
if (get_net_ifs(&p) > 0) {
|
||||||
if (!set_interfaces(p))
|
if (!set_interfaces(p))
|
||||||
sudo_fatal("%s", U_("unable to parse network address list"));
|
sudo_fatal("%s", U_("unable to parse network address list"));
|
||||||
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the parser and set sudoers filename to "sudoers". */
|
/* Initialize the parser and set sudoers filename to "sudoers". */
|
||||||
|
Reference in New Issue
Block a user