On Thu, 28 Aug 2025 10:02:10 +0800 Zongmin Zhou wrote:
> @@ -501,7 +502,8 @@ int main(int argc, char *argv[])
>       if (fd < 0) {
>               fprintf(stderr, "Can't open socket: %s\n", strerror(errno));
>               freeaddrinfo(ai);

Since you added the gotos now perhaps it'd be even better to remove
this freeaddrinfo() call here, and instead jump to a separate label...

> -             return ERN_RESOLVE;
> +             err = ERN_RESOLVE;
> +             goto err_free_buff;
>       }
>  
>       if (opt.sock.proto == IPPROTO_ICMP) {
> @@ -575,5 +577,7 @@ int main(int argc, char *argv[])
>  err_out:
>       close(fd);

... added right here?

>       freeaddrinfo(ai);
> +err_free_buff:
> +     free(buf);
>       return err;

Reply via email to