[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [GNUnet-developers] [PATCH] Fix setup_service memory leak in util/se
From: |
Christian Grothoff |
Subject: |
Re: [GNUnet-developers] [PATCH] Fix setup_service memory leak in util/service.c |
Date: |
Fri, 23 Jun 2017 16:25:57 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
Thanks! Fixed as suggested. Sorry for the delay...
On 06/08/2017 08:40 PM, jah wrote:
> On 07/06/17 08:10, LRN wrote:
>> For that matter, it should be possible to GNUNET_free(addrs[i])
>> unconditionally, before the socket opening check (GCC probably optimizes like
>> that anyway, but why not help it?).
>
> Thank you LRN, yes it is possible and here's the improved patch:-
>
> ---
> src/util/service.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/util/service.c b/src/util/service.c
> index d195452c9..fcdf45a51 100644
> --- a/src/util/service.c
> +++ b/src/util/service.c
> @@ -1283,15 +1283,14 @@ setup_service (struct GNUNET_SERVICE_Handle *sh)
> slc->sh = sh;
> slc->listen_socket = open_listen_socket (addrs[i],
> addrlens[i]);
> + GNUNET_free (addrs[i]);
> if (NULL == slc->listen_socket)
> {
> GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
> "bind");
> - GNUNET_free (addrs[i]);
> GNUNET_free (slc);
> continue;
> }
> - GNUNET_free (addrs[i]);
> GNUNET_CONTAINER_DLL_insert (sh->slc_head,
> sh->slc_tail,
> slc);
>
signature.asc
Description: OpenPGP digital signature