Fix coverity issue (memory leak) 24/214524/2 accepted/tizen_5.5_unified_mobile_hotfix tizen_5.5_mobile_hotfix accepted/tizen/5.5/unified/20191031.021511 accepted/tizen/5.5/unified/mobile/hotfix/20201027.083703 accepted/tizen/unified/20190925.033559 submit/tizen/20190924.014546 submit/tizen_5.5/20191031.000004 submit/tizen_5.5_mobile_hotfix/20201026.185103 tizen_5.5.m2_release
authorjiyong.min <jiyong.min@samsung.com>
Tue, 24 Sep 2019 00:17:56 +0000 (09:17 +0900)
committerJiyong Min <jiyong.min@samsung.com>
Tue, 24 Sep 2019 00:29:57 +0000 (00:29 +0000)
Change-Id: I2494d0d8543ab3dc4fa88cd4520e0bbd20c7397a

utils/mm_file_util_tag.c

index 71b4136..025704f 100644 (file)
@@ -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;
                                                }
                                        }