[0.6.254] fix mem leak 89/258889/1 accepted/tizen/unified/20210602.122637 submit/tizen/20210531.015432
authorEunhye Choi <eunhae1.choi@samsung.com>
Thu, 27 May 2021 07:09:28 +0000 (16:09 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Thu, 27 May 2021 07:09:31 +0000 (16:09 +0900)
- reported by coverity

Change-Id: Ia34f9e796d02cde6a3bb97a98b543429dd6403ab

packaging/libmm-player.spec
src/mm_player_priv.c

index 03fc1c1..9e5fbe0 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.253
+Version:    0.6.254
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index b8946c5..c838ff1 100644 (file)
@@ -3785,7 +3785,6 @@ __mmplayer_gst_create_plain_text_elements(mmplayer_t *player)
        LOGD("adding created elements to bin");
        if (!_mmplayer_gst_element_add_bucket_to_bin(GST_BIN(textbin[MMPLAYER_T_BIN].gst), element_bucket)) {
                LOGE("failed to add elements");
-               g_list_free(element_bucket);
                goto ERROR;
        }
 
@@ -3797,13 +3796,9 @@ __mmplayer_gst_create_plain_text_elements(mmplayer_t *player)
        LOGD("Linking elements in the bucket by added order.");
        if (_mmplayer_gst_element_link_bucket(element_bucket) == -1) {
                LOGE("failed to link elements");
-               g_list_free(element_bucket);
                goto ERROR;
        }
 
-       /* done. free allocated variables */
-       g_list_free(element_bucket);
-
        if (textbin[MMPLAYER_T_QUEUE].gst) {
                GstPad *pad = NULL;
                GstPad *ghostpad = NULL;
@@ -3829,10 +3824,14 @@ __mmplayer_gst_create_plain_text_elements(mmplayer_t *player)
                }
        }
 
+       g_list_free(element_bucket);
+
        return MM_ERROR_NONE;
 
 ERROR:
 
+       g_list_free(element_bucket);
+
        if (!player->play_subtitle && textbin[MMPLAYER_T_FAKE_SINK].gst) {
                LOGE("remove textbin sink from sink list");
                __mmplayer_del_sink(player, textbin[MMPLAYER_T_FAKE_SINK].gst);
@@ -3846,7 +3845,6 @@ static int
 __mmplayer_gst_create_text_sink_bin(mmplayer_t *player)
 {
        mmplayer_gst_element_t *textbin = NULL;
-       GList *element_bucket = NULL;
        int surface_type = 0;
        gint i = 0;
 
@@ -3897,8 +3895,6 @@ ERROR:
 
        LOGD("ERROR : releasing textbin");
 
-       g_list_free(element_bucket);
-
        /* release signal */
        __mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_TEXTBIN);