lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250829191537.4618f815@kernel.org>
Date: Fri, 29 Aug 2025 19:15:37 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Zongmin Zhou <min_halo@....com>
Cc: horms@...nel.org, davem@...emloft.net, edumazet@...gle.com,
 pabeni@...hat.com, shuah@...nel.org, linux-kernel@...r.kernel.org,
 linux-kselftest@...r.kernel.org, netdev@...r.kernel.org, Zongmin Zhou
 <zhouzongmin@...inos.cn>
Subject: Re: [PATCH v2] selftests: net: avoid memory leak

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;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ