Don't remove a tap listener we didn't find in the first place.

If remove_tap_listener() doesn't find a tap listener with the specified
data, print a warning message and skip the "remove the tap listener"
steps.

This means that the internal free_tap_listener() won't be called with a
null listener; remove the now-unnecessary check (if anybody *does* call
it with a null pointer, that's a bug).

This prevents the crash in bug 15006, but that now produces a warning
message; it doesn't fix the underlying bug, it just changes the symptom.

Change-Id: Ia9a2bfa3d57b86eac0d6e0b0bad03a7b81e254e3
Ping-Bug: 15006
Reviewed-on: https://code.wireshark.org/review/28853
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2018-07-25 11:08:04 -07:00
parent 3071af2550
commit 4a498ae798
1 changed files with 4 additions and 2 deletions

View File

@ -449,8 +449,6 @@ find_tap_id(const char *name)
static void
free_tap_listener(volatile tap_listener_t *tl)
{
if(!tl)
return;
dfilter_free(tl->code);
g_free(tl->fstring);
DIAG_OFF(cast-qual)
@ -615,6 +613,10 @@ remove_tap_listener(void *tapdata)
}
}
if(!tl) {
ws_g_warning("remove_tap_listener(): no listener found with that tap data");
return;
}
}
if(tl->finish)
tl->finish(tapdata);