summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/socket_wrapper/socket_wrapper.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/socket_wrapper/socket_wrapper.c b/lib/socket_wrapper/socket_wrapper.c
index dc0124bdb7..1e3927705b 100644
--- a/lib/socket_wrapper/socket_wrapper.c
+++ b/lib/socket_wrapper/socket_wrapper.c
@@ -901,7 +901,7 @@ static int swrap_get_pcap_fd(const char *fname)
if (write(fd, &file_hdr, sizeof(file_hdr)) != sizeof(file_hdr)) {
close(fd);
- return -1;
+ fd = -1;
}
return fd;
}
@@ -1194,11 +1194,9 @@ static void swrap_dump_packet(struct socket_info *si,
fd = swrap_get_pcap_fd(file_name);
if (fd != -1) {
if (write(fd, packet, packet_len) != packet_len) {
- close(fd);
free(packet);
return;
}
- close(fd);
}
free(packet);