From: Daniel Wagner Date: Mon, 25 Jul 2011 14:24:26 +0000 (+0200) Subject: service: Fix memory leak X-Git-Tag: 0.77~87 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e87d5bffc7e991620ca61d763078770b1cd9297a;p=platform%2Fupstream%2Fconnman.git service: Fix memory leak valgrind reports that __connman_service_nameservers_remove leaks memory. g_strv_length already returns the right size of the new array. --- diff --git a/src/service.c b/src/service.c index b8f6aac..e793d75 100644 --- a/src/service.c +++ b/src/service.c @@ -585,7 +585,7 @@ int __connman_service_nameserver_remove(struct connman_service *service, return 0; } - servers = g_try_new0(char *, len - 1); + servers = g_try_new0(char *, len); if (servers == NULL) return -ENOMEM; @@ -595,7 +595,7 @@ int __connman_service_nameserver_remove(struct connman_service *service, j++; } } - servers[len - 2] = NULL; + servers[len - 1] = NULL; g_strfreev(service->nameservers); service->nameservers = servers;