Hi Marcel, On 31 December 2010 20:14, Marcel Holtmann <mar...@holtmann.org> wrote: >> --- a/src/service.c >> +++ b/src/service.c >> @@ -3406,10 +3406,10 @@ int __connman_service_disconnect(struct >> connman_service *service) >> __connman_ipconfig_clear_address(service->ipconfig_ipv4); >> __connman_ipconfig_clear_address(service->ipconfig_ipv6); >> >> - if (__connman_ipconfig_disable(service->ipconfig_ipv4) < 0) >> + if (!__connman_ipconfig_disable(service->ipconfig_ipv4)) >> service->ipconfig_ipv4 = NULL; >> >> - if (__connman_ipconfig_disable(service->ipconfig_ipv6) < 0) >> + if (!__connman_ipconfig_disable(service->ipconfig_ipv6)) >> service->ipconfig_ipv6 = NULL; > > so what is this fixing actually? We do check the return pointer. >
The __connman_ipconfig_disable() returns 0 if it could release the ipconfig struct so we can then mark the service ipconfig pointer also null. But if <0 is returned, the ipconfig was not cleared by __connman_ipconfig_disable() and the unpatched version still marks the ipconfig pointer null and that will cause the memory leak. After my fix this call to __connman_ipconfig_disable() will look the same as in other parts of service.c. Regards, Jukka _______________________________________________ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman