Merged r4121:4122 from branches/SDL-1.2: more double-free fixes.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 06 Jan 2010 07:34:20 +0000
changeset 3611 57823d017f02
parent 3610 3c1b39d0d1a6
child 3612 ce7d4942d18b
Merged r4121:4122 from branches/SDL-1.2: more double-free fixes.
src/audio/SDL_wave.c
src/events/SDL_events.c
--- a/src/audio/SDL_wave.c	Wed Jan 06 07:26:49 2010 +0000
+++ b/src/audio/SDL_wave.c	Wed Jan 06 07:34:20 2010 +0000
@@ -454,6 +454,7 @@
     do {
         if (chunk.data != NULL) {
             SDL_free(chunk.data);
+            chunk.data = NULL;
         }
         lenread = ReadChunk(src, &chunk);
         if (lenread < 0) {
@@ -553,6 +554,7 @@
     do {
         if (*audio_buf != NULL) {
             SDL_free(*audio_buf);
+            *audio_buf = NULL;
         }
         lenread = ReadChunk(src, &chunk);
         if (lenread < 0) {
@@ -625,6 +627,7 @@
     if (SDL_RWread(src, chunk->data, chunk->length, 1) != 1) {
         SDL_Error(SDL_EFREAD);
         SDL_free(chunk->data);
+        chunk->data = NULL;
         return (-1);
     }
     return (chunk->length);
--- a/src/events/SDL_events.c	Wed Jan 06 07:26:49 2010 +0000
+++ b/src/events/SDL_events.c	Wed Jan 06 07:34:20 2010 +0000
@@ -176,6 +176,7 @@
         SDL_WaitThread(SDL_EventThread, NULL);
         SDL_EventThread = NULL;
         SDL_DestroyMutex(SDL_EventLock.lock);
+        SDL_EventLock.lock = NULL;
     }
     if (SDL_EventQ.lock) {
         SDL_DestroyMutex(SDL_EventQ.lock);