Repository navigation
Fix curl handle/header leaks and per-event socket leak on Linux - #54
Merged
Merged
Conversation
LCOV of commit
|
dorin-ga
approved these changes
Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the two leaks reported in GameAnalytics/GA-SDK-UNITY#59.
Curl client (all desktop platforms)
curl_easy_cleanupwas skipped whencurl_easy_performfailed — each failed request leaked the easy handle (on Windows this pins two loopback TCP sockets per failure, eventually exhausting sockets machine-wide withWSAENOBUFS).curl_slistwas never freed — leaked on every request.Both are now owned by RAII guards (
std::unique_ptrwith curl deleters), so every exit path cleans up. Also removed a duplicateCURLOPT_SSL_VERIFYPEERsetopt.Linux
getConnectionType()The inner
int sock = socket(...)shadowed the outersock, soclose()never ran — leaking one socket per network interface per event. Now a single socket is opened per call, reused for every interface ioctl, closed once; the loop breaks early once WIFI is detected. Semantics unchanged.