[master] c8559db55 Only free addrinfo if it is non-NULL

Dridi Boukelmoune dridi at varni.sh
Thu May 9 07:43:42 UTC 2019


On Thu, May 9, 2019 at 9:18 AM Poul-Henning Kamp <phk at freebsd.org> wrote:
>
>
> commit c8559db555f63d4cddfef845ff4d0d8f48c9b5a3
> Author: Poul-Henning Kamp <phk at FreeBSD.org>
> Date:   Thu May 9 07:17:10 2019 +0000
>
>     Only free addrinfo if it is non-NULL
>
> diff --git a/lib/libvarnish/vss.c b/lib/libvarnish/vss.c
> index 0ad31a5b9..4431dea0d 100644
> --- a/lib/libvarnish/vss.c
> +++ b/lib/libvarnish/vss.c
> @@ -108,7 +108,7 @@ int
>  VSS_resolver_socktype(const char *addr, const char *def_port,
>      vss_resolved_f *func, void *priv, const char **err, int socktype)
>  {
> -       struct addrinfo hints, *res0, *res;
> +       struct addrinfo hints, *res0 = NULL, *res;
>         struct suckaddr *vsa;
>         char *h;
>         char *adp, *hop;
> @@ -143,7 +143,8 @@ VSS_resolver_socktype(const char *addr, const char *def_port,
>                                 break;
>                 }
>         }
> -       freeaddrinfo(res0);
> +       if (res0 != NULL)
> +               freeaddrinfo(res0);

For some reason, still failing on SunOS. I think we should really mark
the Coverity defect as a false positive instead so they can fix it.

>         return (ret);
>  }
>
> _______________________________________________
> varnish-commit mailing list
> varnish-commit at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit


More information about the varnish-commit mailing list