Merge "Fix for CID:860243" into tizen
[platform/core/connectivity/net-config.git] / gtest / vpn.cpp
index ec42fba..fe57050 100755 (executable)
@@ -53,12 +53,14 @@ error_e Vpnsvc::vpn_init(const char *iface_name, int iface_name_len, int *result
 
        if ((iface_fd = open("/dev/net/tun", O_RDWR)) < 0) {
                GLOGD("tun device open fail\n");
+               g_object_unref(fd_list);
                return ERROR_OPERATION_FAILED;
        }
 
        g_unix_fd_list_append(fd_list, iface_fd, &g_error);
        if (g_error != NULL) {
                close(iface_fd);
+               g_object_unref(fd_list);
                return ERROR_OPERATION_FAILED;
        }
 
@@ -73,12 +75,14 @@ error_e Vpnsvc::vpn_init(const char *iface_name, int iface_name_len, int *result
        if (message == NULL) {
                GLOGD("Failed to invoke dbus method");
                close(iface_fd);
+               g_object_unref(fd_list);
                return error;
        }
 
        g_variant_get(message, "(iis)", result, h_index, h_name);
        g_variant_unref(message);
        close(iface_fd);
+       g_object_unref(fd_list);
 
        return ERROR_NONE;
 }