Skip to content

Commit

Permalink
fix some more memory leaks in ec_globals.c
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Koeppe authored and LocutusOfBorg committed Jan 26, 2023
1 parent 43d047b commit 106c0d1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/ec_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ struct ec_options {
char *target1;
char *target2;
char *script;
char *script_orig;
char *ssl_cert;
char *ssl_pkey;
FILE *msg_fd;
Expand Down
8 changes: 8 additions & 0 deletions src/ec_globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ void ec_globals_free(void)
{

capture_freeifs();
EC_GBL_FREE(ec_gbls->pcap->filter);
EC_GBL_FREE(ec_gbls->pcap);
EC_GBL_FREE(ec_gbls->lnet);
EC_GBL_FREE(ec_gbls->iface);
Expand All @@ -98,8 +99,15 @@ void ec_globals_free(void)
EC_GBL_FREE(ec_gbls->options->iface_bridge);
EC_GBL_FREE(ec_gbls->options->target1);
EC_GBL_FREE(ec_gbls->options->target2);
EC_GBL_FREE(ec_gbls->options->script_orig);
EC_GBL_FREE(ec_gbls->options->address);
EC_GBL_FREE(ec_gbls->options->netmask);
EC_GBL_FREE(ec_gbls->options->hostsfile);
EC_GBL_FREE(ec_gbls->options->ssl_cert);
EC_GBL_FREE(ec_gbls->options->ssl_pkey);
EC_GBL_FREE(ec_gbls->stats);
EC_GBL_FREE(ec_gbls->options);
EC_GBL_FREE(ec_gbls->conf->file);
EC_GBL_FREE(ec_gbls->conf);
/* destroy the list structure */
filter_clear();
Expand Down
2 changes: 2 additions & 0 deletions src/ec_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ void set_quiet(void)
void set_script(char *script)
{
EC_GBL_OPTIONS->script = strdup(script);
/* Keep original pointer for later free() operation */
EC_GBL_OPTIONS->script_orig = EC_GBL_OPTIONS->script;
}

void set_silent(void)
Expand Down

0 comments on commit 106c0d1

Please sign in to comment.