diff --git a/include/ec_globals.h b/include/ec_globals.h index 028e16f61..814780148 100644 --- a/include/ec_globals.h +++ b/include/ec_globals.h @@ -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; diff --git a/src/ec_globals.c b/src/ec_globals.c index 4e039851c..29c981cf3 100644 --- a/src/ec_globals.c +++ b/src/ec_globals.c @@ -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); @@ -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(); diff --git a/src/ec_set.c b/src/ec_set.c index bbcdfbc6b..6d1080c6f 100644 --- a/src/ec_set.c +++ b/src/ec_set.c @@ -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)