Fix Svace issue 52/191052/1 accepted/tizen_5.0_unified accepted/tizen/5.0/unified/20181102.013325 accepted/tizen/unified/20181011.100330 submit/tizen/20181011.054514 submit/tizen_5.0/20181101.000002
authorJihoon Jung <jh8801.jung@samsung.com>
Thu, 11 Oct 2018 05:16:44 +0000 (14:16 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Thu, 11 Oct 2018 05:17:01 +0000 (14:17 +0900)
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
Change-Id: I0f0fd8013a4e39e180c5f6ea5671b8af2168b958

src/mtp_gdbus_manager.c

index ff2e427..e422333 100755 (executable)
@@ -160,9 +160,17 @@ mtp_error_e mtp_gdbus_manager_get_devices(int **mtp_devices, int *device_num)
                                        (*mtp_devices)[i] = g_variant_get_int32(key_value);
                        }
                        i++;
-                       g_variant_iter_free(iter_row);
+
+                       if (iter_row != NULL) {
+                               g_variant_iter_free(iter_row);
+                               iter_row = NULL;
+                       }
+               }
+
+               if (iter != NULL) {
+                       g_variant_iter_free(iter);
+                       iter = NULL;
                }
-               g_variant_iter_free(iter);
        }
 
        g_variant_unref(va);
@@ -209,9 +217,17 @@ mtp_error_e mtp_gdbus_manager_get_storages(int mtp_device,
                                        (*mtp_storages)[i] = g_variant_get_int32(key_value);
                        }
                        i++;
-                       g_variant_iter_free(iter_row);
+
+                       if (iter_row != NULL) {
+                               g_variant_iter_free(iter_row);
+                               iter_row = NULL;
+                       }
+               }
+
+               if (iter != NULL) {
+                       g_variant_iter_free(iter);
+                       iter = NULL;
                }
-               g_variant_iter_free(iter);
        }
 
        g_variant_unref(va);
@@ -261,9 +277,17 @@ mtp_error_e mtp_gdbus_manager_get_object_handles(int mtp_device,
                                        (*object_handles)[i] = g_variant_get_int32(key_value);
                        }
                        i++;
-                       g_variant_iter_free(iter_row);
+
+                       if (iter_row != NULL) {
+                               g_variant_iter_free(iter_row);
+                               iter_row = NULL;
+                       }
+               }
+
+               if (iter != NULL) {
+                       g_variant_iter_free(iter);
+                       iter = NULL;
                }
-               g_variant_iter_free(iter);
        }
 
        g_variant_unref(va);