[1.1.1] Fix Coverity issue (Dereference before null check) 33/317833/4 accepted/tizen_unified_dev accepted/tizen/unified/20240920.050205 accepted/tizen/unified/dev/20240924.080611 accepted/tizen/unified/toolchain/20241004.101540 accepted/tizen/unified/x/20240920.102416
authorGilbok Lee <gilbok.lee@samsung.com>
Thu, 19 Sep 2024 06:35:11 +0000 (15:35 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Thu, 19 Sep 2024 09:07:10 +0000 (18:07 +0900)
- Fix build warning

Change-Id: I08dcc9bbf430d891f6a3ee3bd4bedb79ee20e27b

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

index db5a7375a036a063161be9e5604fabfc26f421a9..4b6dfe86ec8afb9e20710d23533e1b4003c10b13 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    1.1.0
+Version:    1.1.1
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 9b0ebf77151e991685ac2b308bffb035ae895027..4f313a50a9d35c88a7a1aba5a9f543ef1c088ec2 100644 (file)
@@ -5150,7 +5150,6 @@ _mmplayer_unrealize(MMHandleType hplayer)
 {
        mmplayer_t *player = (mmplayer_t *)hplayer;
        int ret = MM_ERROR_NONE;
-       int rm_ret = MM_ERROR_NONE;
        mmplayer_resource_type_e res_idx = MMPLAYER_RESOURCE_TYPE_MAX;
 
        MMPLAYER_FENTER();
@@ -7261,8 +7260,6 @@ _mmplayer_gst_decode_autoplug_sort(GstElement *bin,
        GstElementFactory *factory = NULL;
        guint new_pos = DEFAULT_IDX;
        guint rm_pos = DEFAULT_IDX;
-       const gchar *klass = NULL;
-       gchar *factory_name = NULL;
        guint hw_dec_idx = DEFAULT_IDX;
        guint first_sw_dec_idx = DEFAULT_IDX;
        guint last_sw_dec_idx = DEFAULT_IDX;
@@ -7281,6 +7278,8 @@ _mmplayer_gst_decode_autoplug_sort(GstElement *bin,
 #endif
 
        for (int i = 0 ; i < factories->n_values ; i++) {
+               const gchar *klass = NULL;
+               gchar *factory_name = NULL;
                gchar *hw_dec_info = NULL;
                gchar (*sw_dec_info)[PLAYER_INI_MAX_STRLEN] = {NULL, };
                factory = g_value_get_object(g_value_array_get_nth(factories, i));
@@ -7313,23 +7312,26 @@ _mmplayer_gst_decode_autoplug_sort(GstElement *bin,
                        continue;
                }
 
+               if (!factory_name) {
+                       LOGW("Factory name is NULL");
+                       continue;
+               }
+
                if (g_strrstr(factory_name, hw_dec_info)) {
                        hw_dec_idx = i;
-               } else {
-                       for (int j = 0; sw_dec_info[j][0] != '\0'; j++) {
-                               if (factory_name && strstr(factory_name, sw_dec_info[j])) {
-                                       last_sw_dec_idx = i;
-                                       if (first_sw_dec_idx == DEFAULT_IDX) {
-                                               first_sw_dec_idx = i;
-                                       }
-                               }
-                       }
+                       continue;
+               }
 
-                       if (first_sw_dec_idx == DEFAULT_IDX) {
-                               if (factory_name)
-                                       LOGW("unknown codec %s", factory_name);
+               for (int j = 0; sw_dec_info[j][0] != '\0'; j++) {
+                       if (g_strrstr(factory_name, sw_dec_info[j])) {
+                               last_sw_dec_idx = i;
+                               if (first_sw_dec_idx == DEFAULT_IDX)
+                                       first_sw_dec_idx = i;
                        }
                }
+
+               if (first_sw_dec_idx == DEFAULT_IDX)
+                       LOGW("unknown codec %s", factory_name);
        }
 
        if (hw_dec_idx == DEFAULT_IDX || first_sw_dec_idx == DEFAULT_IDX)
index 3574e558304ec67a2adf4d3873900bb4142ee892..359c083f732405254b19648f673f5de0366790cd 100644 (file)
@@ -184,7 +184,7 @@ int _mmplayer_rm_allocate(mmplayer_t *player, mmplayer_resource_type_e type)
        ret = rm_allocate_resources(player->res.handle, &request_resources, device);
        if (ret != RM_OK) {
                LOGW("Resource allocation request failed ret %d [error type %d]", ret, device->error_type);
-               MM_ERROR_PLAYER_INTERNAL;
+               return MM_ERROR_PLAYER_INTERNAL;
        }
 
        for (idx = 0; idx < device->allocated_num; idx++)
@@ -277,4 +277,3 @@ int _mmplayer_rm_release(mmplayer_t *player)
        return MM_ERROR_NONE;
 }
 #endif /* RM_COMMON */
-