From 4ac4ab31a32fd58e7180ba086baaabc48bd5f4a9 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 25 Apr 2017 00:45:09 -0700 Subject: Don't crash if we have no BOOTP option preferences. wmem_list_foreach() crashes if handed a null pointer, and saved_uat_opts will be null if there are no BOOTP option preferences. Don't do the "free saved UAT options" stuff if there aren't any saved UAT options. Bug: 13655 Change-Id: I88e64c6ebec88fc04a5adc0a85d378bbba49b383 Reviewed-on: https://code.wireshark.org/review/21329 Reviewed-by: Guy Harris --- epan/dissectors/packet-bootp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-bootp.c b/epan/dissectors/packet-bootp.c index 500c12f5e5..6c590a6a6e 100644 --- a/epan/dissectors/packet-bootp.c +++ b/epan/dissectors/packet-bootp.c @@ -6340,10 +6340,13 @@ bootp_clear_uat_bootpopt(gpointer data, gpointer user_data _U_) static void bootp_cleanup_protocol(void) { - wmem_list_foreach(saved_uat_opts, bootp_clear_uat_bootpopt, NULL); + if (saved_uat_opts != NULL) { + wmem_list_foreach(saved_uat_opts, bootp_clear_uat_bootpopt, + NULL); - wmem_destroy_list(saved_uat_opts); - saved_uat_opts = NULL; + wmem_destroy_list(saved_uat_opts); + saved_uat_opts = NULL; + } } -- cgit v1.2.3