Fix a small leak.

This commit is contained in:
Damiano Galassi committed 2017-05-11 12:50:55 +02:00
1 parent dc11909e68
commit b5739ed2c0
2 files changed
+14 -1

No files matched your search

+1 -1
View File
@@ -19,7 +19,7 @@ extern "C" {
int analyze_EAC3(void **context ,uint8_t *frame, uint32_t size);
CFDataRef createCookie_EAC3(void *context);
void free_EAC3_context(void *context);
typedef struct MPEG4AudioConfig {
int object_type;
+13
View File
@@ -760,6 +760,9 @@ concatenate:
if (!info->num_blocks) {
// Copy the frame
if (info->frame) {
free(info->frame);
}
info->frame = (uint8_t *)malloc(size);
if (info->frame == NULL) {
return -2;
@@ -820,6 +823,7 @@ CFDataRef createCookie_EAC3(void *context)
}
free(info->frame);
info->frame = NULL;
uint8_t *buffer = cookie.GetBuffer();
size_t size = cookie.GetBitPosition() / 8;
@@ -829,6 +833,15 @@ CFDataRef createCookie_EAC3(void *context)
return cookieData;
}
void free_EAC3_context(void *context)
{
struct eac3_info *info = (struct eac3_info *) context;
free(info->frame);
info->frame = NULL;
free(context);
}
#pragma mark - MPEG 4 Audio
#define ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))