Skip to content

Commit c7807cf

Browse files
committed
MP3Decoder: Need to zero out storage
1 parent 34a46de commit c7807cf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ports/espressif/common-hal/audiomp3/__init__.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,20 @@
2525
*/
2626

2727
#include <stdlib.h>
28+
#include <string.h>
2829
#include "py/mpprint.h"
2930
#include "esp_heap_caps.h"
3031
#include "shared-module/audiomp3/__init__.h"
3132
#include "supervisor/port_heap.h"
3233

3334
void *mp3_alloc(size_t sz) {
3435
void *ptr = heap_caps_malloc(sz, MALLOC_CAP_8BIT);
35-
mp_printf(&mp_plat_print, "alloc(%d) -> %ptr\n", (int)sz, ptr);
36+
if (ptr) {
37+
memset(ptr, 0, sz);
38+
}
3639
return ptr;
3740
}
3841

3942
void mp3_free(void *ptr) {
40-
mp_printf(&mp_plat_print, "free(%p)\n", ptr);
4143
heap_caps_free(ptr);
4244
}

0 commit comments

Comments
 (0)