changeset 3611:57823d017f02

Merged r4121:4122 from branches/SDL-1.2: more double-free fixes.
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 06 Jan 2010 07:34:20 +0000
parents 3c1b39d0d1a6
children ce7d4942d18b
files src/audio/SDL_wave.c src/events/SDL_events.c
diffstat 2 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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);