summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2010-10-26 22:05:19 +0200
committerGravatar waker <wakeroid@gmail.com>2010-10-26 22:05:19 +0200
commitf0df86487d95fce966d9e17d8b647bf2ac621c4d (patch)
treee24e4b17d74cf863559f04f16ad3f1b85dfc0e1e
parent206c222c80983a8f30d628e8b3575d7ae02f07b3 (diff)
added workaround for possible mp4ff parser bug
-rw-r--r--plugins/aac/aac.c10
-rw-r--r--plugins/aac/mp4ff/mp4ff.c5
2 files changed, 12 insertions, 3 deletions
diff --git a/plugins/aac/aac.c b/plugins/aac/aac.c
index 2f6b518b..f7925b82 100644
--- a/plugins/aac/aac.c
+++ b/plugins/aac/aac.c
@@ -726,13 +726,17 @@ aac_read_int16 (DB_fileinfo_t *_info, char *bytes, int size) {
sampleDuration, MP4_MSECS_TIME_SCALE);
#endif
if (info->mp4sample >= info->mp4samples) {
+ if (buffer) {
+ free (buffer);
+ }
break;
}
info->mp4sample++;
samples = NeAACDecDecode(info->dec, &frame_info, buffer, buffer_size);
-#ifdef USE_MP4FF
- free (buffer);
-#endif
+
+ if (buffer) {
+ free (buffer);
+ }
if (!samples) {
break;
}
diff --git a/plugins/aac/mp4ff/mp4ff.c b/plugins/aac/mp4ff/mp4ff.c
index 9181ace9..ce33aad5 100644
--- a/plugins/aac/mp4ff/mp4ff.c
+++ b/plugins/aac/mp4ff/mp4ff.c
@@ -30,6 +30,7 @@
#include <stdlib.h>
#include <string.h>
+#include <stdio.h>
#include "mp4ffint.h"
mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f)
@@ -426,6 +427,10 @@ int32_t mp4ff_read_sample(mp4ff_t *f, const int32_t track, const int32_t sample,
if (*bytes==0) return 0;
*audio_buffer = (uint8_t*)malloc(*bytes);
+ if (!(*audio_buffer)) {
+ fprintf (stderr, "mp4ff_read_sample: malloc failure (tried to alloc %d bytes). possible mp4ff bug or memleak! please report a bug to deadbeef developers (i'm serious).\n", *bytes);
+ return 0;
+ }
mp4ff_set_sample_position(f, track, sample);