aboutsummaryrefslogtreecommitdiffstats
path: root/extcap
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2015-06-18 09:10:55 +0200
committerMichal Labedzki <michal.labedzki@tieto.com>2015-06-19 13:20:57 +0000
commit7ec7e43f3be20d7c79b5b62252ed368aca79e54a (patch)
tree3cb0c60d98b8f00095c165c8293bc036cae6fe4b /extcap
parent9e4b299d2c7e7dce5e5277b4bcc4d6b11f13ef2b (diff)
Bluetooth: Coverity fixes
Try to fix Coverity issues in Bluetooth HCI and androiddump. Change-Id: Id2ed35130eb4dbb0698b7a54afccdba56af62bfd Reviewed-on: https://code.wireshark.org/review/8983 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'extcap')
-rw-r--r--extcap/androiddump.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/extcap/androiddump.c b/extcap/androiddump.c
index eec27601dd..c96be11e4a 100644
--- a/extcap/androiddump.c
+++ b/extcap/androiddump.c
@@ -254,6 +254,11 @@ static struct extcap_dumper extcap_dumper_open(char *fifo, int encap) {
pcap = pcap_open_dead_with_tstamp_precision(encap_ext, PACKET_LENGTH, PCAP_TSTAMP_PRECISION_NANO);
extcap_dumper.dumper.pcap = pcap_dump_open(pcap, fifo);
+ if (!extcap_dumper.dumper.pcap) {
+ if (verbose)
+ fprintf(stderr, "ERROR: Cannot save dump file\n");
+ exit(1);
+ }
extcap_dumper.encap = encap;
pcap_dump_flush(extcap_dumper.dumper.pcap);
#else
@@ -270,6 +275,11 @@ static struct extcap_dumper extcap_dumper_open(char *fifo, int encap) {
}
extcap_dumper.dumper.wtap = wtap_dump_open(fifo, WTAP_FILE_TYPE_SUBTYPE_PCAP_NSEC, encap_ext, PACKET_LENGTH, FALSE, &err);
+ if (!extcap_dumper.dumper.wtap) {
+ if (verbose)
+ fprintf(stderr, "ERROR: Cannot save dump file\n");
+ exit(1);
+ }
extcap_dumper.encap = encap;
wtap_dump_flush(extcap_dumper.dumper.wtap);
#endif
@@ -1440,6 +1450,7 @@ static int capture_android_bluetooth_external_parser(char *interface,
*bt_local_tcp_port, *bt_server_tcp_port, result);
}
+ memset(&server, 0 , sizeof(server));
server.sin_family = AF_INET;
server.sin_port = GINT16_TO_BE(*bt_local_tcp_port);
server.sin_addr.s_addr = inet_addr(bt_local_ip);
@@ -1526,7 +1537,6 @@ static int capture_android_bluetooth_external_parser(char *interface,
if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {
if (verbose)
printf("ERROR1: %s\n", strerror(errno));
- closesocket(sock);
return 1;
}