We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 632

Summary: Possible memory leak in Windows mouse input handling
Product: SDL Reporter: Tim Angus <tim>
Component: eventsAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: critical    
Priority: P2    
Version: HG 2.0   
Hardware: x86   
OS: Windows (All)   

Description Tim Angus 2008-09-24 03:35:56 UTC
Let me preface this report by saying I haven't actually tried running the code here and it's possible I'm just overlooking something (albeit something not obvious). If this is the case I apologise profusely in advance :).

It looks to me like there is a pretty horrendous memory leak in the handling of WM_INPUT messages in WIN_WindowProc/SDL_win32events.c.

            lpb = SDL_malloc(size * sizeof(LPBYTE));

I can't see the companion SDL_free for this allocation. It is freed by something that the lpb/raw pointer is passed to? And if so is SDL_free used to free it? In any case doing a memory allocation for every mouse event is probably not best practice, regardless of whether it leaks or not.
Comment 1 Tim Angus 2008-10-15 08:18:51 UTC
Looked like this was fixed in r4105.