summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaurav Babu <saurav.babu@samsung.com>2017-06-06 06:46:34 (GMT)
committerSaurav Babu <saurav.babu@samsung.com>2017-06-07 03:48:48 (GMT)
commit4dc972d927cd9f5854eb4f2d50cfafe931705e21 (patch)
tree84bc1d32e17f7b02d19fe6ced1e479ead8885af0
parent6d0c59f3bfb3b4ef7881f925097dae1f75ea9990 (diff)
downloadconnman-4dc972d927cd9f5854eb4f2d50cfafe931705e21.zip
connman-4dc972d927cd9f5854eb4f2d50cfafe931705e21.tar.gz
connman-4dc972d927cd9f5854eb4f2d50cfafe931705e21.tar.bz2
service: Fix memory leak issuesrefs/changes/92/132492/2
This patch fixes memory leak on loading service passphrase. g_strdup() function returns NULL only when nameserver will be NULL and it has already been checked before so there is no need to check for return of g_strdup(). Change-Id: I3ddd3af135a35ba03bd01ccd5a68f822ed1dac26 Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
-rwxr-xr-xsrc/service.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/service.c b/src/service.c
index 259a497..4f7b9b8 100755
--- a/src/service.c
+++ b/src/service.c
@@ -612,6 +612,8 @@ static int service_load_passphrase(struct connman_service *service)
if (str)
service->passphrase = str;
+ g_key_file_free(keyfile);
+
return 0;
}
@@ -1739,9 +1741,6 @@ int __connman_service_nameserver_append(struct connman_service *service,
return -ENOMEM;
nameservers[len] = g_strdup(nameserver);
- if (!nameservers[len])
- return -ENOMEM;
-
nameservers[len + 1] = NULL;
#ifdef TIZEN_EXT