mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 15:57:00 +00:00
various: fix memory leaks
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
8da98bbc89
commit
d2d8abd660
4 changed files with 11 additions and 5 deletions
|
|
@ -178,6 +178,7 @@ int main(int argc, char **argv)
|
|||
config.output_limit[i] =
|
||||
optarg[i] - '0';
|
||||
} else {
|
||||
clean_up();
|
||||
errx(EXIT_FAILURE,
|
||||
"main: output mask `%s' is illegal",
|
||||
optarg);
|
||||
|
|
@ -242,6 +243,7 @@ int main(int argc, char **argv)
|
|||
output_analysis = output_csv;
|
||||
break;
|
||||
default:
|
||||
clean_up();
|
||||
errx(EXIT_FAILURE, "main: unknown output format `%c'",
|
||||
config.output_format[0]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ void delete_all_leases(void)
|
|||
{
|
||||
struct leases_t *l, *tmp;
|
||||
HASH_ITER(hh, leases, l, tmp) {
|
||||
free(l->ethernet);
|
||||
HASH_DEL(leases, l);
|
||||
free(l);
|
||||
}
|
||||
|
|
|
|||
12
src/other.c
12
src/other.c
|
|
@ -411,16 +411,18 @@ void clean_up(void)
|
|||
if (fflush(NULL)) {
|
||||
warn("clean_up: fflush");
|
||||
}
|
||||
num_shared_networks++;
|
||||
for (i = 0; i < num_shared_networks; i++) {
|
||||
free((shared_networks + i)->name);
|
||||
}
|
||||
free(config.dhcpdconf_file);
|
||||
free(config.dhcpdlease_file);
|
||||
free(config.output_file);
|
||||
free(ranges);
|
||||
delete_all_leases();
|
||||
free(shared_networks);
|
||||
if (shared_networks) {
|
||||
num_shared_networks++;
|
||||
for (i = 0; i < num_shared_networks; i++) {
|
||||
free((shared_networks + i)->name);
|
||||
}
|
||||
free(shared_networks);
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief A version printing. */
|
||||
|
|
|
|||
|
|
@ -213,6 +213,7 @@ comparer_t field_selector(char c)
|
|||
case 'e':
|
||||
return comp_tcperc;
|
||||
default:
|
||||
clean_up();
|
||||
warnx("field_selector: unknown sort order `%c'", c);
|
||||
errx(EXIT_FAILURE, "Try `%s --help' for more information.",
|
||||
program_name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue