Hi, can someone check this one out? Is there something wrong with it?

On Thu, Jan 17, 2019, at 13:21, Uman Shahzad wrote:
> If we fail to initialize pollers due to fdtab/fdinfo/polled_mask
> not getting allocated, we free any of those that were allocated
> and exit. However the ordering was incorrect, and there was an old
> unused and unreachable "fail_cache" path as well.
> ---
> src/fd.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/src/fd.c b/src/fd.c
> index 84cb9080..daebe783 100644
> --- a/src/fd.c
> +++ b/src/fd.c
> @@ -525,7 +525,6 @@ int init_pollers()
>  
> if ((fdtab = calloc(global.maxsock, sizeof(struct fdtab))) == NULL)
> goto fail_tab;
> -
> if ((polled_mask = calloc(global.maxsock, sizeof(unsigned long))) == NULL)
> goto fail_polledmask;
> if ((fdinfo = calloc(global.maxsock, sizeof(struct fdinfo))) == NULL)
> @@ -559,13 +558,11 @@ int init_pollers()
> } while (!bp || bp->pref == 0);
> return 0;
>  
> - fail_cache:
> - free(fdinfo);
>  fail_info:
> - free(fdtab);
> - fail_tab:
> free(polled_mask);
>  fail_polledmask:
> + free(fdtab);
> + fail_tab:
> return 0;
> }
>  
> -- 
> 2.20.1
> 
> 

Reply via email to