Skip to content

Conversation

moon044
Copy link

@moon044 moon044 commented Jul 24, 2025

What this fixes

Hi,
This PR fixes a resource leak in pcap-linux.c.
If malloc() fails after opening a socket, the file descriptor is not closed, which can cause a resource leak.

Fix

Added close(sock_fd); before returning on allocation failure.

Thank you for the review!

@moon044 moon044 force-pushed the fix-resource-leak-pcap-linux branch from e191d41 to 4a3a4fb Compare July 24, 2025 14:58
@moon044 moon044 requested a review from guyharris July 28, 2025 04:34
@guyharris guyharris merged commit ac48be2 into the-tcpdump-group:master Jul 28, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants