From f9fd438b6d8d5fb535881e94f736025b46a3fcc4 Mon Sep 17 00:00:00 2001 From: Mikael Kanstrup Date: Fri, 30 Jun 2017 15:16:25 +0200 Subject: androiddump: Close socket on failure path Fix a few cases where socket is not closed on failure path. Change-Id: Id116a8e5f14979f962fdf725c62999758b79109e Reviewed-on: https://code.wireshark.org/review/22481 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- extcap/androiddump.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extcap/androiddump.c b/extcap/androiddump.c index 3e65902f6b..9407b38e6f 100644 --- a/extcap/androiddump.c +++ b/extcap/androiddump.c @@ -2393,6 +2393,7 @@ static int capture_android_tcpdump(char *interface, char *fifo, regex = g_regex_new(regex_linktype, (GRegexCompileFlags)0, (GRegexMatchFlags)0, &err); if (!regex) { g_warning("Failed to compile regex for tcpdump data link type matching"); + closesocket(sock); return EXIT_CODE_GENERIC; } @@ -2409,6 +2410,7 @@ static int capture_android_tcpdump(char *interface, char *fifo, } else if (errno != 0) { g_warning("ERROR capture: %s", strerror(errno)); + closesocket(sock); g_regex_unref(regex); return EXIT_CODE_GENERIC; } @@ -2546,6 +2548,7 @@ static int capture_android_tcpdump(char *interface, char *fifo, } else if (errno != 0) { g_warning("ERROR capture: %s", strerror(errno)); + closesocket(sock); return EXIT_CODE_GENERIC; } -- cgit v1.2.1