From 21e98d3439f3ad5d21ae9e9476ee943067fc4d9f Mon Sep 17 00:00:00 2001 From: "jiyong.min" Date: Tue, 24 Sep 2019 09:17:56 +0900 Subject: [PATCH] Fix coverity issue (memory leak) Change-Id: I2494d0d8543ab3dc4fa88cd4520e0bbd20c7397a --- utils/mm_file_util_tag.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/utils/mm_file_util_tag.c b/utils/mm_file_util_tag.c index 71b4136..025704f 100644 --- a/utils/mm_file_util_tag.c +++ b/utils/mm_file_util_tag.c @@ -2719,25 +2719,21 @@ static void __id3tag_parse_APIC_picture(AvFileContentInfo *pInfo, unsigned char pInfo->imageInfo.bURLInfo = true; } -static bool _mm_file_id3tag_parse_PIC(AvFileContentInfo *pInfo, unsigned char *pTagVal, int nTagLen, const char *pCharSet) +static void _mm_file_id3tag_parse_PIC(AvFileContentInfo *pInfo, unsigned char *pTagVal, int nTagLen, const char *pCharSet) { /* current position to read pTagVal */ int offset = 0; debug_fenter(RELEASE); - if (!__id3tag_parse_PIC_format(pInfo, pTagVal, &offset)) { + if (!__id3tag_parse_PIC_format(pInfo, pTagVal, &offset)) debug_msg(RELEASE, "PIC is not valid\n"); - return false; - } __id3tag_parse_APIC_pictype(pInfo, pTagVal, &offset); __id3tag_parse_APIC_desc(pInfo, pTagVal, nTagLen, pCharSet, &offset); __id3tag_parse_APIC_picture(pInfo, pTagVal, nTagLen, &offset); debug_fleave(RELEASE); - - return true; } static bool _mm_file_id3tag_parse_APIC(AvFileContentInfo *pInfo, unsigned char *pTagVal, int nTagLen, const char *pCharSet) @@ -2921,6 +2917,7 @@ bool mm_file_id3tag_parse_v222(AvFileContentInfo *pInfo, unsigned char *buffer) if (encodingOffSet < purelyFramelen) { realCpyFrameNum = purelyFramelen - encodingOffSet; + mmfile_free(pExtContent); pExtContent = mmfile_malloc(realCpyFrameNum + 3); if (pExtContent == NULL) { @@ -3035,8 +3032,7 @@ bool mm_file_id3tag_parse_v222(AvFileContentInfo *pInfo, unsigned char *buffer) pInfo->tagV2Info.bRecDateMarked = true; } else if (strncmp((char *)CompTmp, "PIC", 3) == 0 && pInfo->tagV2Info.bImageMarked == false && realCpyFrameNum <= 2000000) { debug_msg(DEBUG, "text encoding %d \n", textEncodingType); - if (!_mm_file_id3tag_parse_PIC(pInfo, pExtContent, realCpyFrameNum, (const char*)charset_array[textEncodingType])) - continue; + _mm_file_id3tag_parse_PIC(pInfo, pExtContent, realCpyFrameNum, (const char*)charset_array[textEncodingType]); pInfo->tagV2Info.bImageMarked = true; } } -- 2.7.4