Skip to content

Commit

Permalink
allow recursice call to tcpedit_dlt_cleanup()
Browse files Browse the repository at this point in the history
This is just a quick hack to prevent a double-free should
tcpedit_dlt_cleanup() call itself, which can hapen through dlt_jnpr_ether_cleanup()

Ref: appneta#813
  • Loading branch information
GabrielGanne committed Jan 28, 2024
1 parent 334ec5b commit ae25286
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/tcpedit/plugins/dlt_plugins.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,16 +442,18 @@ void
tcpedit_dlt_cleanup(tcpeditdlt_t *ctx)
{
tcpeditdlt_plugin_t *plugin;
tcpeditdlt_plugin_t *plugin_orig;

assert(ctx);

plugin = ctx->plugins;
plugin_orig = plugin = ctx->plugins;
ctx->plugins = NULL;
while (plugin != NULL) {
plugin->plugin_cleanup(ctx);
plugin = plugin->next;
}

plugin = ctx->plugins;
plugin = plugin_orig;;
while (plugin != NULL) {
tcpeditdlt_plugin_t *plugin_next = plugin->next;
safe_free(plugin);
Expand Down

0 comments on commit ae25286

Please sign in to comment.