Remove duplicate verification code 87/184987/3 accepted/tizen/5.0/unified/20181102.014853 accepted/tizen/unified/20180730.142100 submit/tizen/20180727.055504 submit/tizen_5.0/20181101.000003
authorMinje Ahn <minje.ahn@samsung.com>
Wed, 25 Jul 2018 03:55:18 +0000 (12:55 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Wed, 25 Jul 2018 07:57:56 +0000 (16:57 +0900)
Use mmfile_free instead of FREE_EX
Remove duplicate null check

Change-Id: I73101a08098966b1e026d2d0c384632abc1c74d9
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
21 files changed:
codecs/ffmpeg/mm_file_codecs.c
formats/ffmpeg/include/mm_file_format_id3tag.h
formats/ffmpeg/mm_file_format_aac.c
formats/ffmpeg/mm_file_format_amr.c
formats/ffmpeg/mm_file_format_ffmpeg.c
formats/ffmpeg/mm_file_format_frame.c
formats/ffmpeg/mm_file_format_imelody.c
formats/ffmpeg/mm_file_format_midi.c
formats/ffmpeg/mm_file_format_mmf.c
formats/ffmpeg/mm_file_format_mp3.c
formats/ffmpeg/mm_file_format_tags.c
formats/ffmpeg/mm_file_format_wav.c
formats/ffmpeg/mm_file_formats.c
mm_file.c
packaging/libmm-fileinfo.spec
utils/include/mm_file_utils.h
utils/mm_file_util_io.c
utils/mm_file_util_io_file.c
utils/mm_file_util_io_mem.c
utils/mm_file_util_io_mmap.c
utils/mm_file_util_tag.c

index 7e9df69b266d06c174d532baef8bf7884bc1dd00..7186aa03fed0abbdabb59ba7ed8b48e400fe1582 100755 (executable)
@@ -91,7 +91,7 @@ int mmfile_codec_open(MMFileCodecContext **codecContext, int codecType, int code
        return MMFILE_CODEC_SUCCESS;
 
 exception:
-       if (codecObject)    mmfile_free(codecObject);
+       mmfile_free(codecObject);
 
        return ret;
 }
@@ -119,7 +119,8 @@ int mmfile_codec_close(MMFileCodecContext *codecContext)
 
        if (codecContext->Decode)       codecContext->Decode = NULL;
        if (codecContext->Close)        codecContext->Close = NULL;
-       if (codecContext->privateData)  mmfile_free(codecContext->privateData);
+
+       mmfile_free(codecContext->privateData);
        mmfile_free(codecContext);
 
        return MMFILE_CODEC_SUCCESS;
index 1f22a6650b87c3256b024995d7e3299c06427e70..338755822b4978c1ed91facec7503c258c4fa608 100755 (executable)
@@ -236,26 +236,26 @@ typedef struct {
 inline static void mm_file_free_AvFileContentInfo(AvFileContentInfo *pInfo)
 {
        if (pInfo) {
-               if (pInfo->pToc) mmfile_free(pInfo->pToc);
-               if (pInfo->pTitle) mmfile_free(pInfo->pTitle);
-               if (pInfo->pArtist) mmfile_free(pInfo->pArtist);
-               if (pInfo->pAuthor) mmfile_free(pInfo->pAuthor);
-               if (pInfo->pCopyright) mmfile_free(pInfo->pCopyright);
-               /*if (pInfo->pDescription) mmfile_free(pInfo->pDescription); */
-               if (pInfo->pComment) mmfile_free(pInfo->pComment);
-               if (pInfo->pRating) mmfile_free(pInfo->pRating);
-               if (pInfo->pAlbum) mmfile_free(pInfo->pAlbum);
-               if (pInfo->pAlbum_Artist) mmfile_free(pInfo->pAlbum_Artist);
-               if (pInfo->pYear) mmfile_free(pInfo->pYear);
-               if (pInfo->pGenre) mmfile_free(pInfo->pGenre);
-               if (pInfo->pTrackNum) mmfile_free(pInfo->pTrackNum);
-               if (pInfo->pRecDate) mmfile_free(pInfo->pRecDate);
-               if (pInfo->pContentGroup) mmfile_free(pInfo->pContentGroup);
-               if (pInfo->pEncBy) mmfile_free(pInfo->pEncBy);
-               if (pInfo->pURL) mmfile_free(pInfo->pURL);
-               if (pInfo->pOriginArtist) mmfile_free(pInfo->pOriginArtist);
-               if (pInfo->pComposer) mmfile_free(pInfo->pComposer);
-               if (pInfo->imageInfo.pImageBuf) mmfile_free(pInfo->imageInfo.pImageBuf);
+               mmfile_free(pInfo->pToc);
+               mmfile_free(pInfo->pTitle);
+               mmfile_free(pInfo->pArtist);
+               mmfile_free(pInfo->pAuthor);
+               mmfile_free(pInfo->pCopyright);
+               /* mmfile_free(pInfo->pDescription); */
+               mmfile_free(pInfo->pComment);
+               mmfile_free(pInfo->pRating);
+               mmfile_free(pInfo->pAlbum);
+               mmfile_free(pInfo->pAlbum_Artist);
+               mmfile_free(pInfo->pYear);
+               mmfile_free(pInfo->pGenre);
+               mmfile_free(pInfo->pTrackNum);
+               mmfile_free(pInfo->pRecDate);
+               mmfile_free(pInfo->pContentGroup);
+               mmfile_free(pInfo->pEncBy);
+               mmfile_free(pInfo->pURL);
+               mmfile_free(pInfo->pOriginArtist);
+               mmfile_free(pInfo->pComposer);
+               mmfile_free(pInfo->imageInfo.pImageBuf);
        }
 }
 
index d2bfa58d121ab38806c6cf7d98c0dc2c613e2931..35e05b8db183c065342f548f1424ad13caa44854 100755 (executable)
@@ -267,13 +267,9 @@ int _parse_id3_tag(tMMFILE_AAC_HANDLE *pData)
 
 
 failure:
-       if (tagBuff) {
-               mmfile_free(tagBuff);
-               tagBuff = NULL;
-       }
+       mmfile_free(tagBuff);
 
        return ret;
-
 }
 
 
@@ -923,10 +919,7 @@ int mmfile_format_close_aac(MMFileFormatContext *formatContext)
                }
        }
 
-       if (formatContext->streams[MMFILE_AUDIO_STREAM]) {
-               mmfile_free(formatContext->streams[MMFILE_AUDIO_STREAM]);
-               formatContext->streams[MMFILE_AUDIO_STREAM] = NULL;
-       }
+       mmfile_free(formatContext->streams[MMFILE_AUDIO_STREAM]);
 
        formatContext->ReadStream   = NULL;
        formatContext->ReadFrame    = NULL;
index 9cc51398558a094c0915acd98716d138272bea45..9c98fbdacf1c2582aba78fda363f89b3a80202a4 100755 (executable)
@@ -475,10 +475,7 @@ int mmfile_format_close_amr(MMFileFormatContext *formatContext)
                }
        }
 
-       if (formatContext->streams[MMFILE_AUDIO_STREAM]) {
-               mmfile_free(formatContext->streams[MMFILE_AUDIO_STREAM]);
-               formatContext->streams[MMFILE_AUDIO_STREAM] = NULL;
-       }
+       mmfile_free(formatContext->streams[MMFILE_AUDIO_STREAM]);
 
        formatContext->ReadStream   = NULL;
        formatContext->ReadFrame    = NULL;
index a33651730486bf98de2e38516d1b60b84485b940..81bb2a13760e8e2bd01aee7c4555df74c000d716 100755 (executable)
@@ -343,8 +343,9 @@ exception: /* fail to get content information */
        if (formatContext->filesrc->type  == MM_FILE_SRC_TYPE_MEMORY) {
                if (avio_ctx_buffer)
                        av_free(avio_ctx_buffer);
-               if (handle)
-                       mmfile_free(handle);
+
+               mmfile_free(handle);
+
                if (pIOCtx)
                        av_free(pIOCtx);
                if (pFormatCtx)
@@ -523,15 +524,11 @@ int mmfile_format_read_stream_ffmpg(MMFileFormatContext *formatContext)
        return MMFILE_FORMAT_SUCCESS;
 
 exception:
-       if (videoStream) {
-               mmfile_free(videoStream);
-               formatContext->streams[MMFILE_VIDEO_STREAM] = NULL;
-       }
+       mmfile_free(videoStream);
+       mmfile_free(audioStream);
 
-       if (audioStream) {
-               mmfile_free(audioStream);
-               formatContext->streams[MMFILE_AUDIO_STREAM] = NULL;
-       }
+       formatContext->streams[MMFILE_VIDEO_STREAM] = NULL;
+       formatContext->streams[MMFILE_AUDIO_STREAM] = NULL;
 
        if (pFormatCtx) {
                avformat_close_input(&pFormatCtx);
@@ -596,7 +593,7 @@ int mmfile_format_read_tag_ffmpg(MMFileFormatContext *formatContext)
 
                                if ((pkt.data != NULL) && (pkt.size > 0)) {
                                        /*Set mime type*/
-                                       if (formatContext->artworkMime) mmfile_free(formatContext->artworkMime);
+                                       mmfile_free(formatContext->artworkMime);
 
                                        if (codec_id == AV_CODEC_ID_MJPEG)
                                                formatContext->artworkMime = mmfile_strdup("image/jpeg");
@@ -608,7 +605,7 @@ int mmfile_format_read_tag_ffmpg(MMFileFormatContext *formatContext)
                                                debug_error(DEBUG, "Unknown cover type: 0x%x\n", codec_id);
 
                                        /*Copy artwork*/
-                                       if (formatContext->artwork)     mmfile_free(formatContext->artwork);
+                                       mmfile_free(formatContext->artwork);
 
                                        formatContext->artworkSize = pkt.size;
                                        formatContext->artwork = mmfile_malloc(pkt.size);
@@ -699,12 +696,12 @@ int mmfile_format_read_tag_ffmpg(MMFileFormatContext *formatContext)
 
                                                                /* set mime type */
                                                                current_pos = POS_OF_MIME_LEN + DATA_LENGTH; /*current position is mime type */
-                                                               if (formatContext->artworkMime) mmfile_free(formatContext->artworkMime);
+                                                               mmfile_free(formatContext->artworkMime);
                                                                formatContext->artworkMime = strndup((const char *)meta_data + current_pos, mime_len);
 
                                                                /* set art work data */
                                                                current_pos = mime_len  + description_len + (DATA_LENGTH * 8); /*current position is picture data */
-                                                               if (formatContext->artwork) mmfile_free(formatContext->artwork);
+                                                               mmfile_free(formatContext->artwork);
 
                                                                formatContext->artwork = mmfile_malloc(data_len);
                                                                if (formatContext->artwork != NULL)
@@ -895,10 +892,8 @@ int mmfile_format_read_frame_ffmpg(MMFileFormatContext *formatContext, unsigned
 exception:
        if (pVideoCodecCtx)     avcodec_free_context(&pVideoCodecCtx);
 
-       if (frame->frameData) {
-               mmfile_free(frame->frameData);
-               frame->frameData = NULL;
-       }
+       mmfile_free(frame->frameData);
+
        if (pFrame)             av_frame_free(&pFrame);
 
        return ret;
index 5aa3dad55f5ac2de43e8e3ca2673bbecd0281fe8..934b36565cc426fe536a47b8516b4a41ad9f7518 100755 (executable)
@@ -307,8 +307,7 @@ static int __get_fileformat(const char *urifilename, int *format)
 
        if (ret == MMFILE_IO_FAILED) {
                debug_error(DEBUG, "error: mmfile_open\n");
-               if (fp)
-                       mmfile_close(fp);
+               mmfile_close(fp);
                return MMFILE_FORMAT_FAIL;
        }
 
@@ -361,14 +360,12 @@ static int __get_fileformat(const char *urifilename, int *format)
 
        *format = -1;
 
-       if (fp)
-               mmfile_close(fp);
+       mmfile_close(fp);
 
        return MMFILE_FORMAT_FAIL;
 
 FILE_FORMAT_SUCCESS:
-       if (fp)
-               mmfile_close(fp);
+       mmfile_close(fp);
 
        return MMFILE_FORMAT_SUCCESS;
 }
@@ -643,10 +640,8 @@ static int __mmfile_get_frame(AVFormatContext *pFormatCtx, int64_t timestamp, bo
        return MMFILE_FORMAT_SUCCESS;
 
 exception:
-       if (*frame) {
-               mmfile_free(*frame);
-               *frame = NULL;
-       }
+       mmfile_free(*frame);
+
        if (pFrame)                     av_frame_free(&pFrame);
        if (pVideoCodecCtx)     avcodec_free_context(&pVideoCodecCtx);
 
index dd31c80ed7e8c7b1f5754fd389b38cca6bf89511..685b1fa9ab44542dcf5b32eac2b8da4ee16f439c 100755 (executable)
@@ -396,16 +396,13 @@ static int __get_imelody_tag(const char *uriname, tMMFileImelodyTagInfo *tags)
 
                        if (isDone) {
                                if (!strncmp(imy_key_buffer, "NAME", 4)) {
-                                       if (tags->title != NULL)
-                                               mmfile_free(tags->title);
+                                       mmfile_free(tags->title);
                                        tags->title = mmfile_strdup(imy_value_buffer);
                                } else if (!strncmp(imy_key_buffer, "COMPOSER", 8)) {
-                                       if (tags->composer != NULL)
-                                               mmfile_free(tags->composer);
+                                       mmfile_free(tags->composer);
                                        tags->composer = mmfile_strdup(imy_value_buffer);
                                } else if (!strncmp(imy_key_buffer, "COPYRIGHT", 9)) {
-                                       if (tags->copyright != NULL)
-                                               mmfile_free(tags->copyright);
+                                       mmfile_free(tags->copyright);
                                        tags->copyright = mmfile_strdup(imy_value_buffer);
                                }
 
@@ -473,8 +470,8 @@ __get_load_memory(char *src, int *out_size)
        return buf;
 
 failed:
-       if (buf) mmfile_free(buf);
-       if (fp) mmfile_close(fp);
+       mmfile_free(buf);
+       mmfile_close(fp);
        return NULL;
 }
 
index 1f6085f8245fc1018e0672429189079aec1edc59..d0fcd323e7d67a066ab87640a1b9d845f36f3b81 100755 (executable)
@@ -420,10 +420,7 @@ int mmfile_format_close_mid(MMFileFormatContext *formatContext)
                return MMFILE_FORMAT_FAIL;
        }
 
-       if (formatContext->streams[MMFILE_AUDIO_STREAM]) {
-               mmfile_free(formatContext->streams[MMFILE_AUDIO_STREAM]);
-               formatContext->streams[MMFILE_AUDIO_STREAM] = NULL;
-       }
+       mmfile_free(formatContext->streams[MMFILE_AUDIO_STREAM]);
 
        formatContext->ReadStream   = NULL;
        formatContext->ReadFrame    = NULL;
@@ -464,9 +461,9 @@ void
 mmfile_format_free_midi_infomation(MIDI_INFO_SIMPLE *info)
 {
        if (info) {
-               if (info->title) mmfile_free(info->title);
-               if (info->copyright) mmfile_free(info->copyright);
-               if (info->comment) mmfile_free(info->comment);
+               mmfile_free(info->title);
+               mmfile_free(info->copyright);
+               mmfile_free(info->comment);
                mmfile_free(info);
        }
 }
index 10f458d3af386df338b643331cda771d8077edf4..66d673e6e1c2f5b792b1058f960f5810722a06c2 100755 (executable)
@@ -2747,8 +2747,7 @@ mmf_file_mmf_get_duration(char *src, int is_xmf)
 _RELEASE_RESOURCE:
 
        mmfile_close(fp);
-
-       if (buf) mmfile_free(buf);
+       mmfile_free(buf);
 
        return ret_msec;
 }
index 4ab929985e0e48a61e1e4c636509f72aa83d1596..97e98d34c30db237cf0c53729132d38e52c40fbf 100755 (executable)
@@ -843,18 +843,13 @@ __AvFindStartOfMp3Header(MMFileIOHandle *hFile,  unsigned char *buf, AvFileConte
                bufLen = pInfo->fileLen - pInfo->tagV2Info.tagLen;
 
        if (IS_ID3V2_TAG(buf)) {
-
-
                if (pInfo->tagV2Info.tagVersion == 0x02) {
-
                        if (!mm_file_id3tag_parse_v222(pInfo, buf))
                                pInfo->tagV2Info.tagLen = 0;
                } else if (pInfo->tagV2Info.tagVersion == 0x03) {
-
                        if (!mm_file_id3tag_parse_v223(pInfo, buf))
                                pInfo->tagV2Info.tagLen = 0;
                } else if (pInfo->tagV2Info.tagVersion == 0x04) {
-
                        if (!mm_file_id3tag_parse_v224(pInfo, buf)) /* currently 2.4 ver pased by 2.3 routine */
                                pInfo->tagV2Info.tagLen = 0;
                } else {
@@ -913,8 +908,7 @@ __AvFindStartOfMp3Header(MMFileIOHandle *hFile,  unsigned char *buf, AvFileConte
                                }
                                if (__AvParseMp3Header(pInfo, pHeader) == false) {
                                        /*return -1; */
-                                       if (pHeader)
-                                               _FREE_EX(pHeader);
+                                       mmfile_free(pHeader);
                                        debug_warning(DEBUG, "Mp3 parse header failed & index(%d)\n", index);
                                        buf++;
                                        index++;
@@ -930,14 +924,12 @@ __AvFindStartOfMp3Header(MMFileIOHandle *hFile,  unsigned char *buf, AvFileConte
                                }
 
                                if (pInfo->bVbr) {
-                                       if (pHeader)
-                                               _FREE_EX(pHeader);
+                                       mmfile_free(pHeader);
                                        bFoundSync = true;
                                        break;
                                } else {
                                        if (__AvIsValidHeader(pInfo, pHeader)) {
-                                               if (pHeader)
-                                                       _FREE_EX(pHeader);
+                                               mmfile_free(pHeader);
 
                                                __AvGetMp3FrameSize(pInfo);
                                                pInfo->datafileLen = pInfo->fileLen - pInfo->headerPos;
@@ -980,8 +972,7 @@ __AvFindStartOfMp3Header(MMFileIOHandle *hFile,  unsigned char *buf, AvFileConte
                                                debug_warning(DEBUG, "Is not vaild header pHeader\n");
                                        }
                                }
-                               if (pHeader)
-                                       _FREE_EX(pHeader);
+                               mmfile_free(pHeader);
                        } else {
                                debug_warning(RELEASE, "Mp3 file frist byte is 0xff, but not header sync\n");
                        }
@@ -990,7 +981,7 @@ __AvFindStartOfMp3Header(MMFileIOHandle *hFile,  unsigned char *buf, AvFileConte
                index++;
        }
 
-       _FREE_EX(pHeader);
+       mmfile_free(pHeader);
 
        if (mmfile_seek(hFile, 0, SEEK_SET) < 0) {
                debug_error(DEBUG, "seek error!\n");
@@ -1082,13 +1073,11 @@ static int mmf_file_mp3_get_infomation(char *filename, AvFileContentInfo *pInfo)
                }
        } else {
                debug_error(DEBUG, "v2TagExistCheck value read fail!\n");
-               if (v2TagExistCheck)
-                       _FREE_EX(v2TagExistCheck);
+               mmfile_free(v2TagExistCheck);
                goto EXCEPTION;
        }
 
-       if (v2TagExistCheck)
-               _FREE_EX(v2TagExistCheck);
+       mmfile_free(v2TagExistCheck);
 
        if (!(pInfo->fileLen > pInfo->tagV2Info.tagLen))
                pInfo->tagV2Info.tagLen = 0;
@@ -1109,8 +1098,7 @@ static int mmf_file_mp3_get_infomation(char *filename, AvFileContentInfo *pInfo)
                while (readAmount > 0) {
                        if (readAmount >= AV_MP3_HEADER_READ_MAX) {
                                if ((readedDataLen <= _AV_MP3_HEADER_POSITION_MAX + pInfo->tagV2Info.tagLen) && (mmfile_read(hFile, buf + readedDataLen, AV_MP3_HEADER_READ_MAX) <= 0)) {
-                                       if (buf)
-                                               _FREE_EX(buf);
+                                       mmfile_free(buf);
 
                                        goto EXCEPTION;
                                } else {
@@ -1118,8 +1106,7 @@ static int mmf_file_mp3_get_infomation(char *filename, AvFileContentInfo *pInfo)
                                }
                        } else {
                                if ((readedDataLen <= _AV_MP3_HEADER_POSITION_MAX + pInfo->tagV2Info.tagLen) && (mmfile_read(hFile, buf + readedDataLen, readAmount) <= 0)) {
-                                       if (buf)
-                                               _FREE_EX(buf);
+                                       mmfile_free(buf);
 
                                        goto EXCEPTION;
                                } else {
@@ -1140,8 +1127,7 @@ static int mmf_file_mp3_get_infomation(char *filename, AvFileContentInfo *pInfo)
                }
 
                if (mmfile_read(hFile, buf, pInfo->fileLen) <= 0) {
-                       if (buf)
-                               _FREE_EX(buf);
+                       mmfile_free(buf);
                        goto EXCEPTION;
                }
        }
@@ -1156,8 +1142,7 @@ static int mmf_file_mp3_get_infomation(char *filename, AvFileContentInfo *pInfo)
 
        debug_msg(RELEASE, "Header Pos: %ld\n", pInfo->headerPos);
 
-       if (buf)
-               _FREE_EX(buf);
+       mmfile_free(buf);
 
        if (pInfo->headerPos == -1)
                goto EXCEPTION;
index 664a3945dff3a1f83c50103ff57d697e23ed3cec..8ae6385829a51d744ef7d3bfe39a71116bda8981 100755 (executable)
@@ -118,14 +118,8 @@ int MMFileTagsClose(MMFileTagsHandle tagsHandle)
        tMMFileTagsData *privateData = tagsHandle;
 
        if (privateData) {
-               if (privateData->fp) {
-                       mmfile_close(privateData->fp);
-               }
-
-               if (privateData->tagList) {
-                       mmfile_free(privateData->tagList);
-               }
-
+               mmfile_close(privateData->fp);
+               mmfile_free(privateData->tagList);
                mmfile_free(privateData);
        }
 
index cf694ee8ca2d27e48ce4373b03ed03382fe9cff5..28834fc676a85eacacd662997d4d80f2d5309053 100755 (executable)
@@ -358,8 +358,7 @@ int mmfile_format_close_wav(MMFileFormatContext *formatContext)
                return MMFILE_FORMAT_FAIL;
        }
 
-       if (formatContext->privateFormatData)
-               mmfile_free(formatContext->privateFormatData);
+       mmfile_free(formatContext->privateFormatData);
 
        return MMFILE_FORMAT_SUCCESS;
 }
@@ -473,8 +472,8 @@ mmf_file_wave_get_header(char *src)
        return header;
 
 failed:
-       if (header) mmfile_free(header);
-       if (fp) mmfile_close(fp);
+       mmfile_free(header);
+       mmfile_close(fp);
 
        return NULL;
 }
index 6bdeee54f49b95765751731bdec200ea0f706bf7..0da0866e2409278ee0b74cb6db64f0e93bd11e45 100755 (executable)
@@ -123,57 +123,53 @@ static int _CleanupFrameContext(MMFileFormatContext *formatContext, bool clean_a
                if (formatContext->ReadTag)             formatContext->ReadTag          = NULL;
                if (formatContext->Close)                       formatContext->Close                    = NULL;
 
-               if (formatContext->uriFileName)         mmfile_free(formatContext->uriFileName);
-               if (formatContext->title)                               mmfile_free(formatContext->title);
-               if (formatContext->artist)                              mmfile_free(formatContext->artist);
-               if (formatContext->author)                      mmfile_free(formatContext->author);
-               if (formatContext->composer)                    mmfile_free(formatContext->composer);
-               if (formatContext->album)                               mmfile_free(formatContext->album);
-               if (formatContext->album_artist)                mmfile_free(formatContext->album_artist);
-               if (formatContext->copyright)                   mmfile_free(formatContext->copyright);
-               if (formatContext->description)                 mmfile_free(formatContext->description);
-               if (formatContext->comment)                     mmfile_free(formatContext->comment);
-               if (formatContext->genre)                               mmfile_free(formatContext->genre);
-               if (formatContext->classification)              mmfile_free(formatContext->classification);
-               if (formatContext->year)                                mmfile_free(formatContext->year);
-               if (formatContext->recDate)                     mmfile_free(formatContext->recDate);
-               if (formatContext->tagTrackNum)         mmfile_free(formatContext->tagTrackNum);
-               if (formatContext->rating)                              mmfile_free(formatContext->rating);
-               if (formatContext->artworkMime)         mmfile_free(formatContext->artworkMime);
-               if (formatContext->artwork)                     mmfile_free(formatContext->artwork);
-               if (formatContext->conductor)                   mmfile_free(formatContext->conductor);
-               if (formatContext->unsyncLyrics)                mmfile_free(formatContext->unsyncLyrics);
-               if (formatContext->rotate)                              mmfile_free(formatContext->rotate);
-               if (formatContext->stereoMode)                  mmfile_free(formatContext->stereoMode);
-               if (formatContext->stitchingSoftware)   mmfile_free(formatContext->stitchingSoftware);
-               if (formatContext->projectionType)              mmfile_free(formatContext->projectionType);
-               if (formatContext->metadataSourceV2)    mmfile_free(formatContext->metadataSourceV2);
+               mmfile_free(formatContext->uriFileName);
+               mmfile_free(formatContext->title);
+               mmfile_free(formatContext->artist);
+               mmfile_free(formatContext->author);
+               mmfile_free(formatContext->composer);
+               mmfile_free(formatContext->album);
+               mmfile_free(formatContext->album_artist);
+               mmfile_free(formatContext->copyright);
+               mmfile_free(formatContext->description);
+               mmfile_free(formatContext->comment);
+               mmfile_free(formatContext->genre);
+               mmfile_free(formatContext->classification);
+               mmfile_free(formatContext->year);
+               mmfile_free(formatContext->recDate);
+               mmfile_free(formatContext->tagTrackNum);
+               mmfile_free(formatContext->rating);
+               mmfile_free(formatContext->artworkMime);
+               mmfile_free(formatContext->artwork);
+               mmfile_free(formatContext->conductor);
+               mmfile_free(formatContext->unsyncLyrics);
+               mmfile_free(formatContext->rotate);
+               mmfile_free(formatContext->stereoMode);
+               mmfile_free(formatContext->stitchingSoftware);
+               mmfile_free(formatContext->projectionType);
+               mmfile_free(formatContext->metadataSourceV2);
 
                if (clean_all)  /*syncLyrics has to be freed in mm_file_destroy_tag_attrs() except abnormal status */
-                       if (formatContext->syncLyrics)                  mm_file_free_synclyrics_list(formatContext->syncLyrics);
+                       mm_file_free_synclyrics_list(formatContext->syncLyrics);
 
-               if (formatContext->privateFormatData)   mmfile_free(formatContext->privateFormatData);
-               if (formatContext->privateCodecData)    mmfile_free(formatContext->privateCodecData);
+               mmfile_free(formatContext->privateFormatData);
+               mmfile_free(formatContext->privateCodecData);
 
                if (formatContext->nbStreams > 0) {
                        int i = 0;
 
                        /*formatContext->streams[0] is video, formatContext->streams[1] is audio.*/
-                       if (formatContext->streams[0]) mmfile_free(formatContext->streams[0]);
-                       if (formatContext->streams[1]) mmfile_free(formatContext->streams[1]);
+                       mmfile_free(formatContext->streams[0]);
+                       mmfile_free(formatContext->streams[1]);
 
                        for (i = 2; (i < formatContext->nbStreams) && (i < MAXSTREAMS); i++) {
-                               if (formatContext->streams[i]) mmfile_free(formatContext->streams[i]);
+                               mmfile_free(formatContext->streams[i]);
                        }
                }
 
                if (formatContext->thumbNail) {
-                       if (formatContext->thumbNail->frameData)
-                               mmfile_free(formatContext->thumbNail->frameData);
-
-                       if (formatContext->thumbNail->configData)
-                               mmfile_free(formatContext->thumbNail->configData);
-
+                       mmfile_free(formatContext->thumbNail->frameData);
+                       mmfile_free(formatContext->thumbNail->configData);
                        mmfile_free(formatContext->thumbNail);
                }
 
@@ -430,15 +426,13 @@ FILE_FORMAT_FAIL:
 
        *formatEnum = -1;
 
-       if (fp)
-               mmfile_close(fp);
+       mmfile_close(fp);
 
        return MMFILE_FORMAT_FAIL;
 
 
 FILE_FORMAT_SUCCESS:
-       if (fp)
-               mmfile_close(fp);
+       mmfile_close(fp);
 
        return MMFILE_FORMAT_SUCCESS;
 }
@@ -457,8 +451,7 @@ static int _mmfile_format_close(MMFileFormatContext *formatContext, bool clean_a
 
        _CleanupFrameContext(formatContext, clean_all);
 
-       if (formatContext)
-               mmfile_free(formatContext);
+       mmfile_free(formatContext);
 
        return MMFILE_FORMAT_SUCCESS;
 }
index c2e9385e9eefeead3579420443742236be7f1b8d..af6e61ef861b0f0d8f183df608d3b17eb9dab4c3 100755 (executable)
--- a/mm_file.c
+++ b/mm_file.c
@@ -576,8 +576,8 @@ but MMFileUtilGetMetaDataFromMP4() Extract just TAG info. That is needed for mm_
                _info_set_attr_media(attrs, formatContext);
 
        if (frameContext.bCompressed) {
-               if (frameContext.frameData) mmfile_free(frameContext.frameData);
-               if (frameContext.configData) mmfile_free(frameContext.configData);
+               mmfile_free(frameContext.frameData);
+               mmfile_free(frameContext.configData);
 
                if (decodedFrame.frameData) {
                        mmfile_free(decodedFrame.frameData);
@@ -611,11 +611,8 @@ warning:
        formatContext->commandType = MM_FILE_CONTENTS;
 
        if (frameContext.bCompressed) {
-               if (frameContext.frameData)
-                       mmfile_free(frameContext.frameData);
-
-               if (frameContext.configData)
-                       mmfile_free(frameContext.configData);
+               mmfile_free(frameContext.frameData);
+               mmfile_free(frameContext.configData);
 
                if (decodedFrame.frameData) {
                        mmfile_free(decodedFrame.frameData);
@@ -656,10 +653,7 @@ warning:
 
 exception:
        if (frameContext.bCompressed) {
-               if (frameContext.frameData)
                        mmfile_free(frameContext.frameData);
-
-               if (frameContext.configData)
                        mmfile_free(frameContext.configData);
 
                if (decodedFrame.frameData) {
@@ -893,17 +887,10 @@ int mm_file_destroy_tag_attrs(MMHandleType tag_attrs)
        }
 
        ret = mm_attrs_get_data_by_name(tag_attrs, MM_FILE_TAG_ARTWORK, &artwork);
-
-       if (artwork != NULL) {
-               mmfile_free(artwork);
-       }
+       mmfile_free(artwork);
 
        ret = mm_attrs_get_data_by_name(tag_attrs, MM_FILE_TAG_SYNCLYRICS, (void **)&synclyrics_list);
-
-       if (synclyrics_list != NULL) {
-               mm_file_free_synclyrics_list(synclyrics_list);
-       }
-
+       mm_file_free_synclyrics_list(synclyrics_list);
        mmf_attrs_free(tag_attrs);
 
        debug_fleave(RELEASE);
@@ -1134,9 +1121,7 @@ int mm_file_destroy_content_attrs(MMHandleType contents_attrs)
        }
 
        ret = mm_attrs_get_data_by_name(contents_attrs, MM_FILE_CONTENT_VIDEO_THUMBNAIL, &thumbnail);
-       if (thumbnail != NULL) {
-               mmfile_free(thumbnail);
-       }
+       mmfile_free(thumbnail);
 
        mmf_attrs_free(contents_attrs);
 
index d4db10997461590d98d5db6d44820c2007cc59f6..632e05682c6f89dd83dda992058dcb9df0f216c9 100755 (executable)
@@ -1,6 +1,6 @@
 Name:      libmm-fileinfo
 Summary:    Media Fileinfo
-Version:    0.6.74
+Version:    0.6.75
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index db2baf6cc8557b493ab17fef6a7aee419eb13f56..fae44687a91d1e8f1315375244d4b581859d8d7b 100755 (executable)
@@ -119,8 +119,6 @@ int MMFileFormatIsValidAPE(MMFileIOHandle *pFileIO, const char *mmfileuri, int d
 #define MMFILE_AVIO_BUFFER_LEN         32768
 
 #define MMFILE_RDONLY          O_RDONLY
-#define MMFILE_WRONLY          O_WRONLY
-#define MMFILE_RDWR                    O_RDWR
 
 #define MMFILE_SEEK_SET                SEEK_SET
 #define MMFILE_SEEK_CUR                SEEK_CUR
@@ -276,7 +274,6 @@ char *mmfile_strdup_debug(const char *str, const char *func, unsigned int line);
 #define MM_FILE_REVERSE_BYTE_ORDER_INT(i) ((int)((((i)&0xFF000000)>>24) | (((i)&0x00FF0000)>>8) | (((i)&0x0000FF00)<<8) | (((i)&0x000000FF)<<24)))
 #define MM_FILE_REVERSE_BYTE_ORDER_SHORT(s) ((short)((((s)&0xFF00)>>8) | (((s)&0x00FF)<<8)))
 
-#define _FREE_EX(ptr)               { if ((ptr)) {mmfile_free((ptr)); (ptr) = NULL; } }
 #define _STRNCPY_EX(dst, src, size)   { if ((size > 0)) {strncpy((char*)(dst), (char*)(src), (size)); *((dst) + (size)) = '\0'; } }
 
 inline static int __AvMemstr(unsigned char *mem, unsigned char *str, int str_len, int search_range)
@@ -522,30 +519,31 @@ void mm_file_free_synclyrics_list(GList *synclyrics_list);
 inline static void mm_file_free_AvFileContentInfo(AvFileContentInfo *pInfo)
 {
        if (pInfo) {
-               if (pInfo->pToc) mmfile_free(pInfo->pToc);
-               if (pInfo->pTitle) mmfile_free(pInfo->pTitle);
-               if (pInfo->pArtist) mmfile_free(pInfo->pArtist);
-               if (pInfo->pAuthor) mmfile_free(pInfo->pAuthor);
-               if (pInfo->pCopyright) mmfile_free(pInfo->pCopyright);
-               if (pInfo->pDescription) mmfile_free(pInfo->pDescription);
-               if (pInfo->pComment) mmfile_free(pInfo->pComment);
-               if (pInfo->pRating) mmfile_free(pInfo->pRating);
-               if (pInfo->pAlbum) mmfile_free(pInfo->pAlbum);
-               if (pInfo->pAlbum_Artist) mmfile_free(pInfo->pAlbum_Artist);
-               if (pInfo->pYear) mmfile_free(pInfo->pYear);
-               if (pInfo->pGenre) mmfile_free(pInfo->pGenre);
-               if (pInfo->pTrackNum) mmfile_free(pInfo->pTrackNum);
-               if (pInfo->pRecDate) mmfile_free(pInfo->pRecDate);
-               if (pInfo->pConductor) mmfile_free(pInfo->pConductor);
-               if (pInfo->pContentGroup) mmfile_free(pInfo->pContentGroup);
-               if (pInfo->pEncBy) mmfile_free(pInfo->pEncBy);
-               if (pInfo->pURL) mmfile_free(pInfo->pURL);
-               if (pInfo->pOriginArtist) mmfile_free(pInfo->pOriginArtist);
-               if (pInfo->pComposer) mmfile_free(pInfo->pComposer);
-               if (pInfo->pUnsyncLyrics) mmfile_free(pInfo->pUnsyncLyrics);
-               if (pInfo->imageInfo.pImageBuf) mmfile_free(pInfo->imageInfo.pImageBuf);
-               if (pInfo->imageInfo.imageDescription) mmfile_free(pInfo->imageInfo.imageDescription);
-               if (strlen(pInfo->imageInfo.imageMIMEType) > 0) memset(pInfo->imageInfo.imageMIMEType, 0, MP3_ID3_IMAGE_MIME_TYPE_MAX_LENGTH);
+               mmfile_free(pInfo->pToc);
+               mmfile_free(pInfo->pTitle);
+               mmfile_free(pInfo->pArtist);
+               mmfile_free(pInfo->pAuthor);
+               mmfile_free(pInfo->pCopyright);
+               mmfile_free(pInfo->pDescription);
+               mmfile_free(pInfo->pComment);
+               mmfile_free(pInfo->pRating);
+               mmfile_free(pInfo->pAlbum);
+               mmfile_free(pInfo->pAlbum_Artist);
+               mmfile_free(pInfo->pYear);
+               mmfile_free(pInfo->pGenre);
+               mmfile_free(pInfo->pTrackNum);
+               mmfile_free(pInfo->pRecDate);
+               mmfile_free(pInfo->pConductor);
+               mmfile_free(pInfo->pContentGroup);
+               mmfile_free(pInfo->pEncBy);
+               mmfile_free(pInfo->pURL);
+               mmfile_free(pInfo->pOriginArtist);
+               mmfile_free(pInfo->pComposer);
+               mmfile_free(pInfo->pUnsyncLyrics);
+               mmfile_free(pInfo->imageInfo.pImageBuf);
+               mmfile_free(pInfo->imageInfo.imageDescription);
+               if (strlen(pInfo->imageInfo.imageMIMEType) > 0)
+                       memset(pInfo->imageInfo.imageMIMEType, 0, MP3_ID3_IMAGE_MIME_TYPE_MAX_LENGTH);
        }
 }
 
index eee55633be712fdc7c1dd0bb6e0ee0f3e047a798..dbc59be6bc6350ebd2ebf3203d989d29bc4dad93 100755 (executable)
@@ -204,7 +204,7 @@ EXPORT_API
 int mmfile_read(MMFileIOHandle *handle, unsigned char *buf, int size)
 {
        int ret = 0;
-       if (!handle || (handle->flags & MMFILE_WRONLY)) {
+       if (!handle) {
                return MMFILE_IO_FAILED;
        }
 
@@ -220,7 +220,7 @@ EXPORT_API
 int mmfile_write(MMFileIOHandle *handle, unsigned char *buf, int size)
 {
        int ret = 0;
-       if (!handle || !(handle->flags & (MMFILE_WRONLY | MMFILE_RDWR))) {
+       if (!handle) {
                return MMFILE_IO_FAILED;
        }
 
@@ -267,11 +267,8 @@ int mmfile_close(MMFileIOHandle *handle)
 
        ret = handle->iofunc->mmfile_close(handle);
 
-       if (handle->fileName) {
-               mmfile_free(handle->fileName);
-       }
-
-       if (handle) mmfile_free(handle);
+       mmfile_free(handle->fileName);
+       mmfile_free(handle);
 
        return ret;
 }
index f3f116bc646f0e824947b5b7a2e482c1fd2196aa..de81b938e3fe6d180efcee6487b4311750a1688d 100755 (executable)
@@ -39,7 +39,7 @@ typedef struct mmfileiodata {
 static int file_open(MMFileIOHandle *handle, const char *filename, int flags)
 {
        tMMFORMAT_FILEIO_DATA *privateData = NULL;
-       int access = 0;
+       int access = O_RDONLY;
        int fd = 0;
 
        if (!handle || !filename) {
@@ -49,19 +49,11 @@ static int file_open(MMFileIOHandle *handle, const char *filename, int flags)
 
        filename += strlen(handle->iofunc->handleName) + 3; /* :// */
 
-       if (flags & MMFILE_RDWR) {
-               access = O_CREAT | O_TRUNC | O_RDWR;
-       } else if (flags & MMFILE_WRONLY) {
-               access = O_CREAT | O_TRUNC | O_WRONLY;
-       } else {
-               access = O_RDONLY;
-       }
-
 #ifdef O_BINARY
        access |= O_BINARY;
 #endif
 
-       fd = open(filename, access, 0666);
+       fd = open(filename, access);
        if (fd < 0) {
                debug_error(DEBUG, "open error\n");
                return MMFILE_IO_FAILED;
@@ -131,10 +123,9 @@ static long long file_tell(MMFileIOHandle *handle)
 static int file_close(MMFileIOHandle *handle)
 {
        tMMFORMAT_FILEIO_DATA *privateData = handle->privateData;
-       /*int ret = 0;*/
 
        if (privateData) {
-               /*ret = */close(privateData->fd);
+               close(privateData->fd);
                mmfile_free(privateData);
                handle->privateData = NULL;
                return MMFILE_IO_SUCCESS;
index c17c73c3ce11ac2307e44f9208988cbc0efcb84f..5b5717ed101cfe68c51518854f5d658425920ab0 100755 (executable)
@@ -83,10 +83,7 @@ exception:
        }
 
 #if 0  /*dead code */
-       if (memHandle) {
-               mmfile_free(memHandle);
-               handle->privateData  = NULL;
-       }
+       mmfile_free(memHandle);
 #endif
 
        return MMFILE_IO_FAILED;
index e9ecdd971208d26737b2bb445a623f4b45b830d7..633d34fb7a08c6dbdbf27b86ded8d9e6359547ae 100755 (executable)
@@ -46,7 +46,7 @@ static int mmf_mmap_open(MMFileIOHandle *handle, const char *filename, int flags
 {
        MMFMMapIOHandle *mmapHandle = NULL;
        struct stat finfo = {0, };
-       int access = 0;
+       int access = O_RDONLY;
 
        if (!handle || !filename || !handle->iofunc || !handle->iofunc->handleName) {
                debug_error(DEBUG, "invalid param\n");
@@ -63,19 +63,11 @@ static int mmf_mmap_open(MMFileIOHandle *handle, const char *filename, int flags
                return MMFILE_IO_FAILED;
        }
 
-       if (flags & MMFILE_RDWR) {
-               access = O_CREAT | O_TRUNC | O_RDWR;
-       } else if (flags & MMFILE_WRONLY) {
-               access = O_CREAT | O_TRUNC | O_WRONLY;
-       } else {
-               access = O_RDONLY;
-       }
-
 #ifdef O_BINARY
        access |= O_BINARY;
 #endif
 
-       mmapHandle->fd = open(filename, access, 0666);
+       mmapHandle->fd = open(filename, access);
        if (mmapHandle->fd < 0) {
                debug_error(DEBUG, "error: open error: %s\n", filename);
                goto exception;
@@ -95,16 +87,8 @@ static int mmf_mmap_open(MMFileIOHandle *handle, const char *filename, int flags
        mmapHandle->offset = 0;
        mmapHandle->state = 0;
 
-       if (flags & MMFILE_RDWR) {
-               /*mmapHandle->ptr = mmap64(0, mmapHandle->size, PROT_WRITE | PROT_READ, MAP_SHARED, mmapHandle->fd, 0); */
-               mmapHandle->ptr = mmap(0, mmapHandle->size, PROT_WRITE | PROT_READ, MAP_SHARED, mmapHandle->fd, 0);
-       } else if (flags & MMFILE_WRONLY) {
-               /*mmapHandle->ptr = mmap64(0, mmapHandle->size, PROT_WRITE, MAP_SHARED, mmapHandle->fd, 0); */
-               mmapHandle->ptr = mmap(0, mmapHandle->size, PROT_WRITE, MAP_SHARED, mmapHandle->fd, 0);
-       } else {
-               /*mmapHandle->ptr = mmap64(0, mmapHandle->size, PROT_READ, MAP_SHARED, mmapHandle->fd, 0); */
-               mmapHandle->ptr = mmap(0, mmapHandle->size, PROT_READ, MAP_SHARED, mmapHandle->fd, 0);
-       }
+       /*mmapHandle->ptr = mmap64(0, mmapHandle->size, PROT_READ, MAP_SHARED, mmapHandle->fd, 0); */
+       mmapHandle->ptr = mmap(0, mmapHandle->size, PROT_READ, MAP_SHARED, mmapHandle->fd, 0);
 
        if (mmapHandle->ptr == (void *)-1) {
                debug_error(DEBUG, "error: mmap\n");
index 4e0af78d6d851bc40b09298c2279338e58949b08..cd823ba4a323cad2375a994f46c7649a4a9efcda 100755 (executable)
@@ -337,15 +337,14 @@ static int GetStringFromTextTagBox(MMFileFormatContext *formatContext, MMFileIOH
        texttag.text = NULL;
        mmfile_seek(fp, basic_header->start_offset + basic_header->size, SEEK_SET);
 
-       _FREE_EX(temp_text);
+       mmfile_free(temp_text);
 
        return MMFILE_UTIL_SUCCESS;
 
 exception:
        mmfile_seek(fp, basic_header->start_offset + basic_header->size, SEEK_SET);
-       if (texttag.text) {
-               mmfile_free(texttag.text);
-       }
+       mmfile_free(texttag.text);
+
        return ret;
 }
 
@@ -442,7 +441,7 @@ static int GetAlbumFromAlbumTagBox(MMFileFormatContext *formatContext, MMFileIOH
                if (!formatContext->album)
                        formatContext->album = temp_text;
                else
-                       _FREE_EX(temp_text);
+                       mmfile_free(temp_text);
 
                debug_msg(RELEASE, "formatContext->album=%s, strlen=%d\n", formatContext->album, strlen(formatContext->album));
        }
@@ -2097,8 +2096,7 @@ int MMFileUtilGetMetaDataFromMKV(MMFileFormatContext *formatContext)
        }
 
 exit:
-       if (fp)
-               mmfile_close(fp);
+       mmfile_close(fp);
 
        if (buffer)
                free(buffer);
@@ -2757,7 +2755,7 @@ bool mm_file_id3tag_parse_v222(AvFileContentInfo *pInfo, unsigned char *buffer)
 
                                                                                        tmp_genre_len = strlen(tmp_genre);
                                                                                        if (tmp_genre_len > 0) {
-                                                                                               if (pInfo->pGenre) _FREE_EX(pInfo->pGenre);
+                                                                                               mmfile_free(pInfo->pGenre);
                                                                                                pInfo->pGenre = mmfile_malloc(sizeof(char) * (tmp_genre_len + 1));
                                                                                                if (pInfo->pGenre) {
                                                                                                        SAFE_STRLCPY(pInfo->pGenre, tmp_genre, tmp_genre_len + 1);
@@ -2920,7 +2918,7 @@ bool mm_file_id3tag_parse_v222(AvFileContentInfo *pInfo, unsigned char *buffer)
                                        needToloopv2taglen = MP3_TAGv2_22_TXT_HEADER_LEN;
                        }
 
-                       if (pExtContent)        _FREE_EX(pExtContent);
+                       mmfile_free(pExtContent);
                        memset(CompTmp, 0, 4);
                        if (curPos < taglen) {
                                needToloopv2taglen -= oneFrameLen;
@@ -3042,7 +3040,7 @@ bool mm_file_id3tag_parse_v223(AvFileContentInfo *pInfo, unsigned char *buffer)
                                        debug_msg(RELEASE, "this text string(%s) encoded by ISO-8859-1 encodingOffSet(%d)\n", CompTmp, encodingOffSet);
                                }
 
-                               if (pExtContent)        _FREE_EX(pExtContent);
+                               mmfile_free(pExtContent);
 
                                if (encodingOffSet < purelyFramelen) {
                                        realCpyFrameNum = purelyFramelen - encodingOffSet;
@@ -3316,14 +3314,14 @@ bool mm_file_id3tag_parse_v223(AvFileContentInfo *pInfo, unsigned char *buffer)
                                                                                } else {
                                                                                        char_set = mmfile_get_charset((const char *)&pExtContent[tmp]);
                                                                                }
-                                                                               _FREE_EX(lang_info);
+                                                                               mmfile_free(lang_info);
                                                                        }
 
                                                                        if (char_set == NULL) {
                                                                                pInfo->pUnsyncLyrics = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", charset_array[textEncodingType], NULL, (unsigned int *)&pInfo->unsynclyricsLen);
                                                                        } else {
                                                                                pInfo->pUnsyncLyrics = mmfile_string_convert((const char *)&pExtContent[tmp], realCpyFrameNum, "UTF-8", char_set, NULL, (unsigned int *)&pInfo->unsynclyricsLen);
-                                                                               _FREE_EX(char_set);
+                                                                               mmfile_free(char_set);
                                                                        }
                                                                } else {
                                                                        debug_msg(RELEASE, "failed to get Unsynchronised lyrics Info tmp(%d), purelyFramelen - encodingOffSet(%lu)\n", tmp, purelyFramelen - encodingOffSet);
@@ -3364,7 +3362,7 @@ bool mm_file_id3tag_parse_v223(AvFileContentInfo *pInfo, unsigned char *buffer)
 
                                                                                        tmp_genre_len = strlen(tmp_genre);
                                                                                        if (tmp_genre_len > 0) {
-                                                                                               if (pInfo->pGenre) _FREE_EX(pInfo->pGenre);
+                                                                                               mmfile_free(pInfo->pGenre);
                                                                                                pInfo->pGenre = mmfile_malloc(sizeof(char) * (tmp_genre_len + 1));
                                                                                                if (pInfo->pGenre) {
                                                                                                        SAFE_STRLCPY(pInfo->pGenre, tmp_genre, tmp_genre_len + 1);
@@ -3539,7 +3537,7 @@ bool mm_file_id3tag_parse_v223(AvFileContentInfo *pInfo, unsigned char *buffer)
                                debug_msg(RELEASE, "This Frame's size is Zero! purelyFramelen(%lu)\n", purelyFramelen);
                        }
 
-                       if (pExtContent)        _FREE_EX(pExtContent);
+                       mmfile_free(pExtContent);
                        memset(CompTmp, 0, 4);
 
                        if (curPos < taglen) {
@@ -3669,7 +3667,7 @@ bool mm_file_id3tag_parse_v224(AvFileContentInfo *pInfo, unsigned char *buffer)
                                        }
                                }
 
-                               if (pExtContent)        _FREE_EX(pExtContent);
+                               mmfile_free(pExtContent);
 
                                if (encodingOffSet < purelyFramelen) {
                                        realCpyFrameNum = purelyFramelen - encodingOffSet;
@@ -4030,7 +4028,7 @@ bool mm_file_id3tag_parse_v224(AvFileContentInfo *pInfo, unsigned char *buffer)
 
                                                                                        tmp_genre_len = strlen(tmp_genre);
                                                                                        if (tmp_genre_len > 0) {
-                                                                                               if (pInfo->pGenre) _FREE_EX(pInfo->pGenre);
+                                                                                               mmfile_free(pInfo->pGenre);
                                                                                                pInfo->pGenre = mmfile_malloc(sizeof(char) * (tmp_genre_len + 1));
                                                                                                if (pInfo->pGenre) {
                                                                                                        SAFE_STRLCPY(pInfo->pGenre, tmp_genre, tmp_genre_len + 1);
@@ -4290,7 +4288,7 @@ bool mm_file_id3tag_parse_v224(AvFileContentInfo *pInfo, unsigned char *buffer)
                                        needToloopv2taglen = MP3_TAGv2_23_TXT_HEADER_LEN;
                        }
 
-                       if (pExtContent)        _FREE_EX(pExtContent);
+                       mmfile_free(pExtContent);
                        memset(CompTmp, 0, 4);
                        if (curPos < taglen) {
                                needToloopv2taglen -= oneFrameLen;
@@ -4363,7 +4361,7 @@ void mm_file_id3tag_restore_content_info(AvFileContentInfo *pInfo)
                        }
                }
 
-               if (pInfo->pGenre) _FREE_EX(pInfo->pGenre);
+               mmfile_free(pInfo->pGenre);
 
                /*tmpinx = 0;*/
                if (mpegAudioGenre != NULL) {
@@ -4417,8 +4415,7 @@ void mm_file_id3tag_restore_content_info(AvFileContentInfo *pInfo)
                } else {
                        debug_msg(RELEASE, "mpegAudioGenre = %s\n", mpegAudioGenre);
                }
-               if (mpegAudioGenre)
-                       _FREE_EX(mpegAudioGenre);
+               mmfile_free(mpegAudioGenre);
 
        } else {
                debug_msg(RELEASE, "Neither ID3 v1 nor v2 info doesn't have Genre Info.\n");