From: Anjali Nijhara Date: Wed, 18 Oct 2023 10:28:01 +0000 (+0530) Subject: Fix memory leak X-Git-Tag: accepted/tizen/unified/20240119.154736~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F04%2F300204%2F1;p=platform%2Fupstream%2Fconnman.git Fix memory leak Change-Id: I6c90014c1b2ee873d2fcb425f7bfff29e55d2224 --- diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index 0f44766..0c38ad3 100755 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -4364,10 +4364,20 @@ static void signal_network_removed(const char *path, DBusMessageIter *iter) interface_network_removed(iter, interface); } + #if defined TIZEN_EXT -void *copy_vsie_list(gconstpointer src, gpointer data) +gpointer copy_vsie_list(gconstpointer src, gpointer data) { - return g_strdup(src); + unsigned char *str = (unsigned char *)src; + unsigned char *vsie; + vsie = g_try_malloc0(str[1]+2); + + if (vsie) + memcpy(vsie, str, str[1]+2); + else + SUPPLICANT_DBG("Failed to allocate memory"); + + return vsie; } #endif