aboutsummaryrefslogtreecommitdiff
path: root/pcap-linux.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2021-10-05 15:16:30 -0700
committerGuy Harris <gharris@sonic.net>2021-10-05 15:16:30 -0700
commit892212ee18f0b45b56b19d58a0da55fa119e4a8d (patch)
tree088c328ea44a1a411d955cdd5e75b132f15cfff6 /pcap-linux.c
parentacc5cb90d78e467ccaa24953f6a729c623a99f25 (diff)
linux: null handlep->oneshot_buffer after freeing it.
That avoids double-free crashes on certain errors; see GitHub issue
Diffstat (limited to 'pcap-linux.c')
-rw-r--r--pcap-linux.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/pcap-linux.c b/pcap-linux.c
index d8dea580..18c71ea9 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -2684,6 +2684,7 @@ setup_mmapped(pcap_t *handle, int *status)
ret = prepare_tpacket_socket(handle);
if (ret == -1) {
free(handlep->oneshot_buffer);
+ handlep->oneshot_buffer = NULL;
*status = PCAP_ERROR;
return ret;
}
@@ -2694,6 +2695,7 @@ setup_mmapped(pcap_t *handle, int *status)
* fail. create_ring() has set *status.
*/
free(handlep->oneshot_buffer);
+ handlep->oneshot_buffer = NULL;
return -1;
}