linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de>
To: jes@trained-monkey.org
Cc: linux-raid@vger.kernel.org, Wu Guanghao <wuguanghao3@huawei.com>,
	Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>,
	Coly Li <colyli@suse.de>
Subject: [PATCH 3/6] Detail.c: fix memleak in Detail()
Date: Fri,  3 Mar 2023 16:33:20 +0800	[thread overview]
Message-ID: <20230303083323.3406-4-colyli@suse.de> (raw)
In-Reply-To: <20230303083323.3406-1-colyli@suse.de>

From: Wu Guanghao <wuguanghao3@huawei.com>

char *sysdev = xstrdup() but not free() in for loop, will cause memory
leak

Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
Acked-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Acked-by: Coly Li <colyli@suse.de>
---
 Detail.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Detail.c b/Detail.c
index ce7a8445..4ef26460 100644
--- a/Detail.c
+++ b/Detail.c
@@ -303,6 +303,7 @@ int Detail(char *dev, struct context *c)
 				if (path)
 					printf("MD_DEVICE_%s_DEV=%s\n",
 					       sysdev, path);
+				free(sysdev);
 			}
 		}
 		goto out;
-- 
2.39.2


  parent reply	other threads:[~2023-03-03  8:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-03  8:33 [PATCH 0/6] rebased patch set from Wu Guanghao Coly Li
2023-03-03  8:33 ` [PATCH 1/6] util.c: code cleanup for parse_layout_faulty() Coly Li
2023-03-03 10:22   ` Paul Menzel
2023-03-03  8:33 ` [PATCH 2/6] util.c: fix memleak in parse_layout_faulty() Coly Li
2023-03-03  8:33 ` Coly Li [this message]
2023-03-03  8:33 ` [PATCH 4/6] isuper-intel.c: fix double free in load_imsm_mpb() Coly Li
2023-03-03  8:33 ` [PATCH 5/6] super-intel.c: fix memleak in find_disk_attached_hba() Coly Li
2023-03-03  8:33 ` [PATCH 6/6] super-ddf.c: fix memleak in get_vd_num_of_subarray() Coly Li

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=20230303083323.3406-4-colyli@suse.de \
    --to=colyli@suse.de \
    --cc=jes@trained-monkey.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=mariusz.tkaczyk@linux.intel.com \
    --cc=wuguanghao3@huawei.com \
    /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).