diff options
Diffstat (limited to 'epan/tap.c')
-rw-r--r-- | epan/tap.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/epan/tap.c b/epan/tap.c index 5049d2ec3d..36de269192 100644 --- a/epan/tap.c +++ b/epan/tap.c @@ -449,6 +449,15 @@ find_tap_id(const char *name) static void free_tap_listener(tap_listener_t *tl) { + /* The free_tap_listener is called in the error path of + * register_tap_listener (when the dfilter fails to be registered) + * and the finish callback is set after that. + * If this is changed make sure the finish callback is not called + * twice to prevent double-free errors. + */ + if (tl->finish) { + tl->finish(tl->tapdata); + } dfilter_free(tl->code); g_free(tl->fstring); g_free(tl); @@ -616,8 +625,6 @@ remove_tap_listener(void *tapdata) return; } } - if(tl->finish) - tl->finish(tapdata); free_tap_listener(tl); } |