From: Yue Hu <zbestahu@gmail.com>
To: Gao Xiang <hsiangkao@linux.alibaba.com>
Cc: Yue Hu <huyue2@coolpad.com>, linux-erofs@lists.ozlabs.org
Subject: Re: [PATCH v2] erofs-utils: mkfs: fix a memory leak of compression type configuration
Date: Mon, 25 Jul 2022 14:03:34 +0800 [thread overview]
Message-ID: <20220725140334.000006c0.zbestahu@gmail.com> (raw)
In-Reply-To: <Yt4wli4X2aCpBNl7@B-P7TQMD6M-0146.local>
Hi Xiang,
On Mon, 25 Jul 2022 13:56:38 +0800
Gao Xiang <hsiangkao@linux.alibaba.com> wrote:
> Hi Yue,
>
> On Mon, Jul 25, 2022 at 01:45:49PM +0800, Yue Hu wrote:
> > Release the memory allocated for compression type configuration. And no
> > need to consider !optarg case since getopt_long() will do that.
> >
> > Signed-off-by: Yue Hu <huyue2@coolpad.com>
> > ---
>
> What's the difference between v1?
just fix 'configration' -> 'configuration' in summary line.
> The patch itself looks good to me, but I need to try later.
>
> Thanks,
> Gao Xiang
>
> > lib/config.c | 3 +++
> > mkfs/main.c | 4 ----
> > 2 files changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/lib/config.c b/lib/config.c
> > index 3963df2..c316a54 100644
> > --- a/lib/config.c
> > +++ b/lib/config.c
> > @@ -55,6 +55,9 @@ void erofs_exit_configure(void)
> > #endif
> > if (cfg.c_img_path)
> > free(cfg.c_img_path);
> > +
> > + if (cfg.c_compr_alg_master)
> > + free(cfg.c_compr_alg_master);
> > }
> >
> > static unsigned int fullpath_prefix; /* root directory prefix length */
> > diff --git a/mkfs/main.c b/mkfs/main.c
> > index deb8e1f..9f5f1dc 100644
> > --- a/mkfs/main.c
> > +++ b/mkfs/main.c
> > @@ -212,10 +212,6 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
> > long_options, NULL)) != -1) {
> > switch (opt) {
> > case 'z':
> > - if (!optarg) {
> > - cfg.c_compr_alg_master = "(default)";
> > - break;
> > - }
> > /* get specified compression level */
> > for (i = 0; optarg[i] != '\0'; ++i) {
> > if (optarg[i] == ',') {
> > --
> > 2.17.1
prev parent reply other threads:[~2022-07-25 6:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-25 5:45 [PATCH v2] erofs-utils: mkfs: fix a memory leak of compression type configuration Yue Hu
2022-07-25 5:56 ` Gao Xiang
2022-07-25 6:03 ` Yue Hu [this message]
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=20220725140334.000006c0.zbestahu@gmail.com \
--to=zbestahu@gmail.com \
--cc=hsiangkao@linux.alibaba.com \
--cc=huyue2@coolpad.com \
--cc=linux-erofs@lists.ozlabs.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