Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL_Init() and memory leak #301

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

SDL_Init() and memory leak #301

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: HG 1.2
Reported for operating system, platform: Linux, x86

Comments on the original bug report:

On 2007-05-08 06:31:38 +0000, vanpie wrote:

Sorry for my English, but I'm Belgian.

I thinks had discover a little memory leak with the SDL_Init() function. I run on Ubuntu 7.04 and i develops a game with SDL libraries and C language.

These following lines are the return of valgrind:
==9420== Address 0x47DD056 is 14 bytes inside a block of size 16,384 alloc'd
==9420== at 0x402095F: calloc (vg_replace_malloc.c:279)
==9420== by 0x45EE346: XOpenDisplay (in /usr/lib/libX11.so.6.2.0)
==9420== by 0x4093BED: (within /usr/lib/libSDL-1.2.so.0.11.0)
==9420== by 0x409E987: (within /usr/lib/libSDL-1.2.so.0.11.0)
==9420== by 0x408B8B0: SDL_VideoInit (in /usr/lib/libSDL-1.2.so.0.11.0)
==9420== by 0x405E1D0: SDL_InitSubSystem (in /usr/lib/libSDL-1.2.so.0.11.0)
==9420== by 0x405E216: SDL_Init (in /usr/lib/libSDL-1.2.so.0.11.0)
==9420== by 0x8048FF4: main (main.c:5)
....
==9420== LEAK SUMMARY:
==9420== definitely lost: 10 bytes in 2 blocks.
==9420== possibly lost: 0 bytes in 0 blocks.
==9420== still reachable: 23,249 bytes in 393 blocks.
==9420== suppressed: 0 bytes in 0 blocks.

My very simplified C code:
#include <SDL/SDL.h>

int main (){
atexit(SDL_Quit);

if ((SDL_Init(SDL_INIT_VIDEO)) == -1){ //line 5
fprintf(stderr,"Error at SDL_Init : %s\n",SDL_GetError());
return -1;
}

SDL_Quit();
return 0;
}

On 2007-06-02 13:59:02 +0000, Ryan C. Gordon wrote:

Bumping a bunch of bugs to Priority 1 for consideration for the 1.2.12 release.

--ryan.

On 2007-06-15 00:00:19 +0000, Ryan C. Gordon wrote:

This leak could be inside Xlib...it doesn't happen here with your test program and Valgrind.

However, I could see an unlikely case where SDL_Init() fails that might leak in that sort of way, and I've committed a patch for it in svn revision # 3075 for the 1.2 branch (this patch doesn't apply to the 1.3 branch).

--ryan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant