From: Yi Zhang <yi.z.zhang@linux.intel.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Haozhong Zhang <haozhong.zhang@intel.com>,
Eduardo Habkost <ehabkost@redhat.com>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
Richard Henderson <richard.henderson@linaro.org>,
QEMU Developers <qemu-devel@nongnu.org>,
Junyan He <junyan.he@intel.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PULL 4/7] hostmem-file: add the 'pmem' option
Date: Tue, 28 Aug 2018 23:42:57 +0800 [thread overview]
Message-ID: <20180828154256.GH13028@tiger-server> (raw)
In-Reply-To: <20180824201116-mutt-send-email-mst@kernel.org>
On 2018-08-24 at 20:14:37 +0300, Michael S. Tsirkin wrote:
> On Fri, Aug 24, 2018 at 05:57:06PM +0100, Peter Maydell wrote:
> > On 24 August 2018 at 17:53, Michael S. Tsirkin <mst@redhat.com> wrote:
> > > On Fri, Aug 24, 2018 at 04:13:18PM +0100, Peter Maydell wrote:
> > >> object_get_canonical_path_component() returns a string which
> > >> must be freed using g_free().
> >
> > > Like the following? Junyan, could you pls try this one and confirm?
> > >
> > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > >
> > > diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
> > > index 2476dcb435..d88125b86e 100644
> > > --- a/backends/hostmem-file.c
> > > +++ b/backends/hostmem-file.c
> > > @@ -154,11 +154,14 @@ static void file_memory_backend_set_pmem(Object *o, bool value, Error **errp)
> > > #ifndef CONFIG_LIBPMEM
> > > if (value) {
> > > Error *local_err = NULL;
> > > + char *path = object_get_canonical_path_component(o);
> > > +
> > > error_setg(&local_err,
> > > "Lack of libpmem support while setting the 'pmem=on'"
> > > " of %s '%s'. We can't ensure data persistence.",
> > > object_get_typename(o),
> > > - object_get_canonical_path_component(o));
> > > + );
> > > + g_free(path);
> > > error_propagate(errp, local_err);
> > > return;
> >
> > Yep, like that (though I would put the closing ");" on
> > the line with object_get_typename() and delete the trailing comma).
> >
> > thanks
> > -- PMM
>a
Ah.. Thanks Michael/Peter to identify/prepare this fix.
> oh i forgot to add in "path".
> I didn't build with libpmem installed
Maybe you already have libpmem installed yet,
it is *ifndef* CONFIG_LIBPMEM ^_^
> Should have been (still untested):
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
>
> diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
> index 2476dcb435..72e7055ee7 100644
> --- a/backends/hostmem-file.c
> +++ b/backends/hostmem-file.c
> @@ -154,11 +154,14 @@ static void file_memory_backend_set_pmem(Object *o, bool value, Error **errp)
> #ifndef CONFIG_LIBPMEM
> if (value) {
> Error *local_err = NULL;
> + char *path = object_get_canonical_path_component(o);
> +
> error_setg(&local_err,
> "Lack of libpmem support while setting the 'pmem=on'"
> " of %s '%s'. We can't ensure data persistence.",
> object_get_typename(o),
> - object_get_canonical_path_component(o));
> + path);
> + g_free(path);
> error_propagate(errp, local_err);
> return;
> }
>
Ah.. I saw another place still have the seem leak, on the previous few lines in
file_memory_backend_set_pmem, I will prepare another patch to fix the
leaks in these two place.
Regards
Yi.
next prev parent reply other threads:[~2018-08-28 7:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-20 20:24 [Qemu-devel] [PULL 0/7] pc: fixes Michael S. Tsirkin
2018-08-20 20:24 ` [Qemu-devel] [PULL 1/7] memory, exec: Expose all memory block related flags Michael S. Tsirkin
2018-08-20 20:24 ` [Qemu-devel] [PULL 2/7] memory, exec: switch file ram allocation functions to 'flags' parameters Michael S. Tsirkin
2018-08-20 20:24 ` [Qemu-devel] [PULL 3/7] configure: add libpmem support Michael S. Tsirkin
2018-08-20 20:24 ` [Qemu-devel] [PULL 4/7] hostmem-file: add the 'pmem' option Michael S. Tsirkin
2018-08-24 15:13 ` Peter Maydell
2018-08-24 16:53 ` Michael S. Tsirkin
2018-08-24 16:57 ` Peter Maydell
2018-08-24 17:14 ` Michael S. Tsirkin
2018-08-28 15:42 ` Yi Zhang [this message]
2018-08-20 20:24 ` [Qemu-devel] [PULL 5/7] mem/nvdimm: ensure write persistence to PMEM in label emulation Michael S. Tsirkin
2018-08-20 20:24 ` [Qemu-devel] [PULL 6/7] migration/ram: Add check and info message to nvdimm post copy Michael S. Tsirkin
2018-08-20 20:24 ` [Qemu-devel] [PULL 7/7] migration/ram: ensure write persistence on loading all data to PMEM Michael S. Tsirkin
2018-08-21 10:35 ` [Qemu-devel] [PULL 0/7] pc: fixes Peter Maydell
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=20180828154256.GH13028@tiger-server \
--to=yi.z.zhang@linux.intel.com \
--cc=crosthwaite.peter@gmail.com \
--cc=ehabkost@redhat.com \
--cc=haozhong.zhang@intel.com \
--cc=imammedo@redhat.com \
--cc=junyan.he@intel.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=rth@twiddle.net \
--cc=stefanha@redhat.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).