Package: sdl-mixer1.2 / 1.2.12-15

bug-688369-double_free_crash.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Description: Fix crash on double free if loading WAV file failed
 Backported from upstream:
  # HG changeset patch
  # User Sam Lantinga <slouken@libsdl.org>
  # Date 1329087437 18000
  # Node ID 2d713670db9b832b0c5aa700824900bc1fc3c3cd
  # Parent  df72f22b4b411ad4b08f924329678aabd5ac97d6
  Fixed 1418 - crash on double free if loading WAV file failed
Author: Sam Lantinga <slouken@libsdl.org>
Last-Update: 2012-09-23
Bug-Debian: http://bugs.debian.org/688369

diff -r df72f22b4b41 -r 2d713670db9b mixer.c
--- a/mixer.c	Mon Jan 30 21:41:45 2012 -0500
+++ b/mixer.c	Sun Feb 12 17:57:17 2012 -0500
@@ -610,13 +610,15 @@
 			break;
 		default:
 			SDL_SetError("Unrecognized sound file type");
-			return(0);			
+			if ( freesrc ) {
+				SDL_RWclose(src);
+			}
+			loaded = NULL;
+			break;
 	}
 	if ( !loaded ) {
+		/* The individual loaders have closed src if needed */
 		SDL_free(chunk);
-		if ( freesrc ) {
-			SDL_RWclose(src);
-		}
 		return(NULL);
 	}