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 <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Mikael Kanstrup 2017-06-30 15:16:25 +02:00 committed by Michael Mann
parent 91e512985f
commit f9fd438b6d
1 changed files with 3 additions and 0 deletions

View File

@ -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;
}