You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Possible string leak and null dereference in Windows openPort() #202
GetStringUTFChars() returns a native string that must be paired with ReleaseStringUTFChars(). The only release is after CreateFile(), but the
length-check path returns early:
port is still held here, so an overlong port name leaks the acquired chars on
every call — reachable with an ordinary Java string, no OOM required.
GetStringUTFChars() can also return NULL (typically with OutOfMemoryError
pending). The result is used immediately by strlen(port) with no null check, so
on acquisition failure the code dereferences NULL and can crash the process
instead of propagating the exception.
Suggested fix: check the result for NULL right after acquisition, and release port before the early return on the length-check path.
Activity
Fix mem leak in windows openPort
Fix mem leak in windows openPort
hiddenalpha commentedon Jul 3, 2026
Agree. Opened pull 203.
Fix mem leak in windows openPort (#203)