OSDN Git Service

omx: fix another memory leak android-x86-7.1-r2 android-x86-7.1-r3 android-x86-7.1-r4
authorMichael Goffioul <michael.goffioul@gmail.com>
Sun, 29 Apr 2018 04:14:24 +0000 (12:14 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Sun, 29 Apr 2018 04:14:24 +0000 (12:14 +0800)
The 'strdup' call in createSoftOMXComponent() is never freed.

omx/SoftFFmpegAudio.cpp
omx/SoftFFmpegVideo.cpp

index 887620f..d1d27dd 100644 (file)
@@ -1576,12 +1576,12 @@ SoftOMXComponent* SoftFFmpegAudio::createSoftOMXComponent(
         const char *name, const OMX_CALLBACKTYPE *callbacks,
         OMX_PTR appData, OMX_COMPONENTTYPE **component) {
     OMX_AUDIO_CODINGTYPE codingType = OMX_AUDIO_CodingAutoDetect;
-    char *componentRole = NULL;
+    const char *componentRole = NULL;
     enum AVCodecID codecID = AV_CODEC_ID_NONE;
 
     for (size_t i = 0; i < kNumAudioComponents; ++i) {
         if (!strcasecmp(name, kAudioComponents[i].mName)) {
-            componentRole = strdup(kAudioComponents[i].mRole);
+            componentRole = kAudioComponents[i].mRole;
             codingType = kAudioComponents[i].mAudioCodingType;
             codecID = kAudioComponents[i].mCodecID;
             break;
index 48afb49..ae1f1ae 100644 (file)
@@ -836,12 +836,12 @@ SoftOMXComponent* SoftFFmpegVideo::createSoftOMXComponent(
         return NULL;
 
     OMX_VIDEO_CODINGTYPE codingType = OMX_VIDEO_CodingAutoDetect;
-    char *componentRole = NULL;
+    const char *componentRole = NULL;
     enum AVCodecID codecID = AV_CODEC_ID_NONE;
 
     for (size_t i = 0; i < kNumVideoComponents; ++i) {
         if (!strcasecmp(name, kVideoComponents[i].mName)) {
-            componentRole = strdup(kVideoComponents[i].mRole);
+            componentRole = kVideoComponents[i].mRole;
             codingType = kVideoComponents[i].mVideoCodingType;
             codecID = kVideoComponents[i].mCodecID;
             break;