Fix Coverity Defects (REVERSE_INULL) 56/259656/2 accepted/tizen/unified/20210614.061516 submit/tizen/20210610.091033
authorSeungbae Shin <seungbae.shin@samsung.com>
Thu, 10 Jun 2021 11:39:03 +0000 (20:39 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Thu, 10 Jun 2021 11:41:11 +0000 (20:41 +0900)
+ remove unused variable

[Version] 0.13.11
[Issue Type] Coverity

Change-Id: I37723cb57bc7b29d504def5a8500c81a27e7303c

mm_sound_proxy.c
packaging/libmm-sound.spec
testsuite/mm_sound_testsuite_simple.c

index c70ac69..e2e39a6 100644 (file)
@@ -118,6 +118,11 @@ static int parse_device_variant(GVariant *v, int *device_id, const char **device
        g_variant_iter_next(&iter, "b", is_running);
 
        array_v = g_variant_iter_next_value(&iter);
+       if (!array_v) {
+               debug_error("Error iterate on next value");
+               return MM_ERROR_SOUND_INTERNAL;
+       }
+
        *stream_num = g_variant_iter_init(&array_iter, array_v);
        if (*stream_num > MAX_STREAM_ON_DEVICE) {
                debug_error("too many streams on device %d", *stream_num);
@@ -128,8 +133,7 @@ static int parse_device_variant(GVariant *v, int *device_id, const char **device
        while (g_variant_iter_loop(&array_iter, "i", &stream_id[i++])) {}
 
 cleanup:
-       if (array_v)
-               g_variant_unref(array_v);
+       g_variant_unref(array_v);
 
        return ret;
 }
@@ -376,6 +380,10 @@ int mm_sound_proxy_get_current_connected_device_list(int device_flags, GList** d
        }
 
        child = g_variant_get_child_value(result, 0);
+       if (!child) {
+               debug_error("Error getting child value from result");
+               goto cleanup;
+       }
        g_variant_iter_init(&iter, child);
        while (1) {
                device_item = g_malloc0(sizeof(mm_sound_device_t));
@@ -394,8 +402,7 @@ int mm_sound_proxy_get_current_connected_device_list(int device_flags, GList** d
                        break;
                }
        }
-       if (child)
-               g_variant_unref(child);
+       g_variant_unref(child);
 
 #ifdef TIZEN_TV
        device_item = _get_tv_bt_device(device_flags);
index 94c2b52..968f2ed 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and focus server binary
-Version:    0.13.10
+Version:    0.13.11
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 3989f4f..a20e5ba 100755 (executable)
@@ -65,7 +65,7 @@ static char g_file_name[MAX_STRING_LEN];
 static char g_dir_name[MAX_PATH_LEN];
 static int g_focus_watch_index = -1;
 static GMainLoop* g_loop;
-static unsigned int g_subs_id_test, g_subs_id_volume, g_subs_id_device_conn, g_subs_id_device_state;
+static unsigned int g_subs_id_volume, g_subs_id_device_conn, g_subs_id_device_state;
 
 static void interpret(char *buf);
 gboolean timeout_menu_display(void *data);
@@ -286,6 +286,11 @@ gboolean input(GIOChannel *channel)
                g_free(buf);
        }
 
+       if (err) {
+               g_print("g_io_channel_read_line() error (%s)", err->message);
+               g_error_free(err);
+       }
+
        return TRUE;
 }