| Summary: | Possible Memory error when freeing subsystems. | ||
|---|---|---|---|
| Product: | SDL | Reporter: | BJ <bje990> |
| Component: | main | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.0 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
Update.. Figured out what is happening, When freeing resources , In function SDL_QuitSubSystem, the SDL_INIT_VIDEO is being called twice. which will cause the memory error i was experiencing. Ryan, can you valgrind SDL 1.3? Thanks! Valgrind doesn't catch a double free, but the callstack in this bug report appears to be calling SDL_Quit() from somewhere deep under SDL_VideoQuit(), so we destroy a mutex twice. I can't verify that the callstack is trustworthy. But I can't reproduce (valgrind or otherwise) here with the latest in the 1.3 branch. --ryan. I'll download the newest release of 1.3 and see if I still get some errors. I downloaded the newest version SDL 1.3 released after February 19th ... everything seems to be ok... |
When running the testjoystick.c file under linux ( along with the other examples including my own code) The program terminates with the following errors /******************************************************************/ There are 1 joysticks attached Joystick 0: Logitech Logitech Cordless RumblePad 2 axes: 6 balls: 0 hats: 0 buttons: 12 Trying to call SDL_QuitSubSystem *** glibc detected *** ./dist/Debug/GNU-Linux-x86/testjoystick: double free or corruption (fasttop): 0x09f20008 *** ======= Backtrace: ========= /lib/tls/i686/cmov/libc.so.6[0xb7dfa3f4] /lib/tls/i686/cmov/libc.so.6(cfree+0x96)[0xb7dfc456] /usr/local/lib/libSDL-1.3.so.0(SDL_DestroyMutex+0x2e)[0xb7f72f7e] /usr/local/lib/libSDL-1.3.so.0[0xb7f0d89c] /usr/local/lib/libSDL-1.3.so.0(SDL_VideoQuit+0x27)[0xb7f580c7] /usr/local/lib/libSDL-1.3.so.0(SDL_QuitSubSystem+0x68)[0xb7f01638] /usr/local/lib/libSDL-1.3.so.0(SDL_Quit+0x1e)[0xb7f016ee] /usr/local/lib/libSDL-1.3.so.0[0xb7f040df] [0xb7fa9400] /usr/local/lib/libSDL-1.3.so.0[0xb7f62755] /usr/local/lib/libSDL-1.3.so.0[0xb7f65795] /usr/local/lib/libSDL-1.3.so.0[0xb7f0f7eb] /usr/local/lib/libSDL-1.3.so.0[0xb7f0f83b] /usr/local/lib/libSDL-1.3.so.0[0xb7f0d8a6] /usr/local/lib/libSDL-1.3.so.0(SDL_VideoQuit+0x27)[0xb7f580c7] /usr/local/lib/libSDL-1.3.so.0(SDL_QuitSubSystem+0x68)[0xb7f01638] ./dist/Debug/GNU-Linux-x86/testjoystick[0x804933e] /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7da1685] ./dist/Debug/GNU-Linux-x86/testjoystick[0x8048a81] ======= Memory map: ======== 08048000-0804a000 r-xp 00000000 08:06 1605199 /home/bj/NetBeansProjects/testjoystick/dist/Debug/GNU-Linux-x86/testjoystick 0804a000-0804b000 r-xp 00001000 08:06 1605199 /home/bj/NetBeansProjects/testjoystick/dist/Debug/GNU-Linux-x86/testjoystick 0804b000-0804c000 rwxp 00002000 08:06 1605199 /home/bj/NetBeansProjects/testjoystick/dist/Debug/GNU-Linux-x86/testjoystick 09f20000-09f41000 rwxp 09f20000 00:00 0 [heap] b7b00000-b7b21000 rwxp b7b00000 00:00 0 b7b21000-b7c00000 ---p b7b21000 00:00 0 b7c1a000-b7c22000 r-xp 00000000 08:06 1334302 /usr/lib/libXi.so.6.0.0 b7c22000-b7c23000 r-xp 00007000 08:06 1334302 /usr/lib/libXi.so.6.0.0 b7c23000-b7c24000 rwxp 00008000 08:06 1334302 /usr/lib/libXi.so.6.0.0 b7c24000-b7c31000 r-xp 00000000 08:06 1334294 /usr/lib/libXext.so.6.4.0 b7c31000-b7c33000 rwxp 0000c000 08:06 1334294 /usr/lib/libXext.so.6.4.0 b7c33000-b7c37000 r-xp 00000000 08:06 1334290 /usr/lib/libXdmcp.so.6.0.0 b7c37000-b7c38000 rwxp 00003000 08:06 1334290 /usr/lib/libXdmcp.so.6.0.0 b7c38000-b7c3a000 r-xp 00000000 08:06 1334279 /usr/lib/libXau.so.6.0.0 b7c3a000-b7c3b000 rwxp 00001000 08:06 1334279 /usr/lib/libXau.so.6.0.0 b7c3b000-b7c52000 r-xp 00000000 08:06 1335223 /usr/lib/libxcb.so.1.0.0 b7c52000-b7c53000 r-xp 00016000 08:06 1335223 /usr/lib/libxcb.so.1.0.0 b7c53000-b7c54000 rwxp 00017000 08:06 1335223 /usr/lib/libxcb.so.1.0.0 b7c54000-b7c55000 r-xp 00000000 08:06 1335221 /usr/lib/libxcb-xlib.so.0.0.0 b7c55000-b7c56000 r-xp 00000000 08:06 1335221 /usr/lib/libxcb-xlib.so.0.0.0 b7c56000-b7c57000 rwxp 00001000 08:06 1335221 /usr/lib/libxcb-xlib.so.0.0.0 b7c57000-b7d42000 r-xp 00000000 08:06 1333461 /usr/lib/libX11.so.6.2.0 b7d42000-b7d43000 r-xp 000ea000 08:06 1333461 /usr/lib/libX11.so.6.2.0 b7d43000-b7d45000 rwxp 000eb000 08:06 1333461 /usr/lib/libX11.so.6.2.0 b7d45000-b7d47000 rwxp b7d45000 00:00 0 b7d47000-b7d5c000 r-xp 00000000 08:06 1194950 /lib/tls/i686/cmov/libpthread-2.8.90.so b7d5c000-b7d5d000 r-xp 00014000 08:06 1194950 /lib/tls/i686/cmov/libpthread-2.8.90.so b7d5d000-b7d5e000 rwxp 00015000 08:06 1194950 /lib/tls/i686/cmov/libpthread-2.8.90.so b7d5e000-b7d60000 rwxp b7d5e000 00:00 0 b7d60000-b7d62000 r-xp 00000000 08:06 1194930 /lib/tls/i686/cmov/libdl-2.8.90.so b7d62000-b7d63000 r-xp 00001000 08:06 1194930 /lib/tls/i686/cmov/libdl-2.8.90.so b7d63000-b7d64000 rwxp 00002000 08:06 1194930 /lib/tls/i686/cmov/libdl-2.8.90.so b7d64000-b7d88000 r-xp 00000000 08:06 1194932 /lib/tls/i686/cmov/libm-2.8.90.so b7d88000-b7d89000 r-xp 00023000 08:06 1194932 /lib/tls/i686/cmov/libm-2.8.90.so b7d89000-b7d8a000 rwxp 00024000 08:06 1194932 /lib/tls/i686/cmov/libm-2.8.90.so b7d8a000-b7d8b000 rwxp b7d8a000 00:00 0 b7d8b000-b7ee3000 r-xp 00000000 08:06 1194924 /lib/tls/i686/cmov/libc-2.8.90.so b7ee3000-b7ee5000 r-xp 001580Aborted [Press Enter to close window] /***************************************************************/ I assume it may be a memory deallocation error.