netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: heminhong <heminhong@kylinos.cn>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] iproute2: prevent memory leak
Date: Tue, 14 Nov 2023 16:36:17 -0800	[thread overview]
Message-ID: <20231114163617.25a7990f@hermes.local> (raw)
In-Reply-To: <20231114092410.43635-1-heminhong@kylinos.cn>

On Tue, 14 Nov 2023 17:24:10 +0800
heminhong <heminhong@kylinos.cn> wrote:

> +			if (NULL != answer)
> +			{
> +				free(answer);
> +			}

Four style problems here:
	1. Don't use Windows convention of NULL first
	2. Don't use Windows style bracket indentation
	3. Brackets are not used in kernel style for single statment if()
	4. Since free of NULL is a perfectly valid nop. Just call free() and skip the if.

If you read the existing code, you would see that it uses kernel style.
Any change should follow the conventions of existing code.



  reply	other threads:[~2023-11-15  0:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-14  9:24 [PATCH] iproute2: prevent memory leak heminhong
2023-11-15  0:36 ` Stephen Hemminger [this message]
2023-11-15  2:37   ` [PATCH v2] " heminhong
2023-11-15  3:32     ` Florian Westphal
2023-11-15  3:33     ` Stephen Hemminger
2023-11-15  7:56       ` [PATCH v3] " heminhong
2023-11-15 10:23         ` Petr Machata
2023-11-16  3:13           ` [PATCH v4] " heminhong
2023-11-16 12:04             ` Andrea Claudi
2023-11-16 23:05             ` Stephen Hemminger
2023-11-17  0:45               ` Andrea Claudi
2023-11-17  3:31                 ` Stephen Hemminger
2023-11-17 17:20             ` 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=20231114163617.25a7990f@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=heminhong@kylinos.cn \
    --cc=netdev@vger.kernel.org \
    /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).