[Bf-blender-cvs] [f84448d4a00] blender2.8: Fix T52813: Audaspace: Leak when loading factory settings

Dalai Felinto noreply at git.blender.org
Mon Sep 18 16:16:11 CEST 2017


Commit: f84448d4a0019375cf01e52f3320846a98e8f2e8
Author: Dalai Felinto
Date:   Mon Sep 18 16:05:16 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBf84448d4a0019375cf01e52f3320846a98e8f2e8

Fix T52813: Audaspace: Leak when loading factory settings

Patch by Joerg Mueller (neXyon) with some touchups by me.

===================================================================

M	source/blender/blenkernel/intern/sound.c

===================================================================

diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 94fa81308fe..a2568707b0a 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -226,7 +226,7 @@ void BKE_sound_init_once(void)
 	atexit(BKE_sound_exit_once);
 }
 
-static AUD_Device *sound_device;
+static AUD_Device *sound_device = NULL;
 
 void *BKE_sound_get_device(void)
 {
@@ -235,6 +235,9 @@ void *BKE_sound_get_device(void)
 
 void BKE_sound_init(struct Main *bmain)
 {
+	/* Make sure no instance of the sound system is running, otherwise we get leaks. */
+	BKE_sound_exit();
+
 	AUD_DeviceSpecs specs;
 	int device, buffersize;
 	const char *device_name;



More information about the Bf-blender-cvs mailing list