Fix file descriptor leak, thanks to @disaykin

This commit is contained in:
Soner Tari 2023-05-18 00:23:38 +03:00
parent fc7d57469d
commit d48ba1da9a
2 changed files with 2 additions and 1 deletions

View File

@ -402,7 +402,7 @@ logpkt_pcap_build(uint8_t *pkt,
sizeof(ip6_hdr->src_addr));
CHKSUM_ADD_RANGE(sum, ip6_hdr->dst_addr,
sizeof(ip6_hdr->dst_addr));
CHKSUM_ADD_UINT32(sum, ip6_hdr->len);
CHKSUM_ADD_UINT32(sum, (uint32_t)ip6_hdr->len);
CHKSUM_ADD_UINT16(sum, htons(IPPROTO_TCP));
}
tcp_hdr->seq = htonl(seq);

View File

@ -232,6 +232,7 @@ privsep_server_openfile(const char *fn, int mkpath)
log_err_level_printf(LOG_CRIT, "Failed to seek on '%s': %s (%i)\n",
fn, strerror(errno), errno);
errno = tmp;
close(fd);
return -1;
}
return fd;