From 9372ed0664e3a616c340dbc321abe80551ed8002 Mon Sep 17 00:00:00 2001 From: Jiung Yu Date: Thu, 22 Dec 2022 08:27:45 +0900 Subject: [PATCH] Prevent memory leak when initialization failure Change-Id: Ia7dfe1b474deb2de4405fe1b4c4a43582dc6ceb7 Signed-off-by: Yu jiung --- plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c b/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c index ebc9cc7..2daf220 100644 --- a/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c +++ b/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c @@ -3826,6 +3826,7 @@ static int _ws_deinit_dbus_connection(void) memset(g_pd->iface_path, 0x0, DBUS_OBJECT_PATH_MAX); g_object_unref(g_dbus); + g_pd->g_dbus = NULL; __WDP_LOG_FUNC_EXIT__; return 0; } @@ -4461,6 +4462,7 @@ int ws_activate(int concurrent) res = _ws_init_dbus_connection(); if (res < 0) { + _ws_deinit_dbus_connection(); res = __ws_p2p_supplicant_stop(); WDP_LOGI("[/usr/sbin/p2p_supp.sh stop] returns %d", res); res = __ws_p2p_firmware_stop(config->ifname); -- 2.7.4