Fix svace defects 72/101672/1
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 1 Dec 2016 00:46:25 +0000 (09:46 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Fri, 2 Dec 2016 02:32:07 +0000 (18:32 -0800)
[Version] 0.3.80
[Profile] Common
[Issue Type] SVACE

Change-Id: I8dc39d46b8e83346a348c085ebee0ea8732c94dc
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
(cherry picked from commit 3716e87ddaebdc52c9cd2c5fae89684bb1db9a88)

packaging/capi-media-sound-manager.spec
src/sound_manager_private.c

index f609dc7..cc44a0b 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.3.79
+Version:    0.3.80
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index c0d4390..59d2131 100644 (file)
@@ -760,6 +760,12 @@ int _set_manual_route_info(unsigned int index, manual_route_info_s *info)
 
        builder_for_in_devices = g_variant_builder_new(G_VARIANT_TYPE("au"));
        builder_for_out_devices = g_variant_builder_new(G_VARIANT_TYPE("au"));
+       if (!builder_for_in_devices || !builder_for_out_devices) {
+               LOGE("failed to g_variant_builder_new(), builder_for_in_devices(%p), builder_for_out_devices(%p)",
+                       builder_for_in_devices, builder_for_out_devices);
+               ret = MM_ERROR_SOUND_INTERNAL;
+               goto LEAVE;
+       }
        for (i = 0; i < AVAIL_DEVICES_MAX; i++) {
                if (!info->route_in_devices[i])
                        break;
@@ -799,9 +805,11 @@ int _set_manual_route_info(unsigned int index, manual_route_info_s *info)
                info->is_set = true;
 
        g_variant_unref(result);
-       g_variant_builder_unref(builder_for_in_devices);
-       g_variant_builder_unref(builder_for_out_devices);
 LEAVE:
+       if (builder_for_in_devices)
+               g_variant_builder_unref(builder_for_in_devices);
+       if (builder_for_out_devices)
+               g_variant_builder_unref(builder_for_out_devices);
        g_object_unref(conn);
 
        return ret;