From: Jakub Kicinski <kuba@kernel.org>
To: Zongmin Zhou <min_halo@163.com>
Cc: horms@kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, shuah@kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
netdev@vger.kernel.org, Zongmin Zhou <zhouzongmin@kylinos.cn>
Subject: Re: [PATCH v2] selftests: net: avoid memory leak
Date: Fri, 29 Aug 2025 19:15:37 -0700 [thread overview]
Message-ID: <20250829191537.4618f815@kernel.org> (raw)
In-Reply-To: <20250828020210.25475-1-min_halo@163.com>
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;
next prev parent reply other threads:[~2025-08-30 2:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-26 3:15 [PATCH] selftests: net: avoid memory leak Zongmin Zhou
2025-08-27 16:12 ` Simon Horman
2025-08-28 2:02 ` [PATCH v2] " Zongmin Zhou
2025-08-28 19:06 ` Simon Horman
2025-08-30 2:15 ` Jakub Kicinski [this message]
2025-09-01 5:45 ` [PATCH v3] " Zongmin Zhou
2025-09-01 16:45 ` Simon Horman
2025-09-03 0:10 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250829191537.4618f815@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=min_halo@163.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=zhouzongmin@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).