From 03054a9ef3fbb7f123d7f46053a361d4ca0f7de8 Mon Sep 17 00:00:00 2001 From: Abhishek Sansanwal Date: Fri, 6 Jul 2018 11:16:35 +0530 Subject: [PATCH] Fix for CID:860282 Description: Call g_free on resource before return. Signed-off-by: Abhishek Sansanwal Change-Id: I66412afbec1ad04e5e16a2edfe96f913ee1ceb1d --- gtest/vpn.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gtest/vpn.cpp b/gtest/vpn.cpp index b0c56a7..9ad6917 100755 --- a/gtest/vpn.cpp +++ b/gtest/vpn.cpp @@ -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; } -- 2.7.4