[AD] New patch for ex_audio_simple |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: allegro-developers@xxxxxxxxxxxxxxxxxx
- Subject: [AD] New patch for ex_audio_simple
- From: Rm Beer <rmbeer2@xxxxxxxxx>
- Date: Tue, 25 Apr 2017 17:38:59 -0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=o1Q7wxJMzzIiSA6jRWt9TSiMP0DgdiMJzK1bKABoiQU=; b=TlQj+fKDJ3gzwmczsmlAlnKK8xF/wTzxOGI5+++Dsg23hfgLNcp51KSH+AYbeGK8KV XrXdWwk+ly8e5NRIIvSfZctRkJjIQz0XX9GY324IhjBtxh4RN2Ib5co1nJ4SUd6kkNYo IW1EkvBtrtJr+1+gvaEdzZa+iprd49Gq9Luzsv6tgcXlw9OeEaRarCZjFpjDvEG9q6f+ Q+Sy5QnQ2o4aRKOLSyGgsPO819sfUcibnfGSKQsXcNUR9CYXXNmH5+t5FGRkOM4oopNM t9ATo0/6YGS+Bi2YZpXTvkNaOavQvOifyldNkDp+PVCmj5sPdWMH/dbpljFKuZ9FZKEH aacQ==
Fix the leak memory where you press 'r' key.
From 67c902a849ed6b42bc3c9d03ad97e57be8fb418f Mon Sep 17 00:00:00 2001
From: Rm Beer <rmbeer2@xxxxxxxxx>
Date: Tue, 25 Apr 2017 17:32:21 -0300
Subject: [PATCH] Fix ex_audio_simple for avoid the leak memory
---
examples/ex_audio_simple.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/examples/ex_audio_simple.c b/examples/ex_audio_simple.c
index 2f47690ef..b0b75114b 100644
--- a/examples/ex_audio_simple.c
+++ b/examples/ex_audio_simple.c
@@ -98,11 +98,18 @@ Restart:
*/
if (event.keyboard.unichar == 'r') {
al_uninstall_audio();
+ for (i = 0; i < argc && i < MAX_SAMPLE_DATA; i++) {
+ if(sample[i])al_destroy_sample(sample[i]);
+ }
goto Restart;
}
}
}
+ for (i = 0; i < argc && i < MAX_SAMPLE_DATA; i++) {
+ if(sample[i])al_destroy_sample(sample[i]);
+ }
+
/* Sample data and other objects will be automatically freed. */
al_uninstall_audio();
--
2.12.2