From: Abhishek Sansanwal Date: Fri, 6 Jul 2018 05:53:19 +0000 (+0530) Subject: Fix for CID:860243 X-Git-Tag: accepted/tizen/unified/20180711.132737~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F07%2F183507%2F2;p=platform%2Fcore%2Fconnectivity%2Fnet-config.git Fix for CID:860243 Description: Free resource using g_free before returning from the function. Signed-off-by: Abhishek Sansanwal Change-Id: I80dcebd4ed8e99ab14b874cb1a127f4bae274d0a --- diff --git a/gtest/vpn.cpp b/gtest/vpn.cpp index b0c56a7..ec42fba 100755 --- a/gtest/vpn.cpp +++ b/gtest/vpn.cpp @@ -122,12 +122,14 @@ error_e Vpnsvc::vpn_protect(const char *dev_name, 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; } @@ -142,12 +144,14 @@ error_e Vpnsvc::vpn_protect(const char *dev_name, 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, "(i)", result); g_variant_unref(message); close(iface_fd); + g_object_unref(fd_list); return ERROR_NONE; }