[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PULL 01/45] hostmem-file: fixed the memory leak while ge
From: |
David Gibson |
Subject: |
Re: [Qemu-ppc] [PULL 01/45] hostmem-file: fixed the memory leak while get pmem path. |
Date: |
Sun, 21 Oct 2018 18:37:25 +0100 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Thu, Oct 18, 2018 at 05:03:38PM -0300, Eduardo Habkost wrote:
> From: Zhang Yi <address@hidden>
>
> object_get_canonical_path_component() returns a string which
> must be freed using g_free().
>
> Reported-by: Peter Maydell <address@hidden>
> Signed-off-by: Michael S. Tsirkin <address@hidden>
> Signed-off-by: Zhang Yi <address@hidden>
> Message-Id: <address@hidden>
> Reviewed-by: Eduardo Habkost <address@hidden>
> Signed-off-by: Eduardo Habkost <address@hidden>
Reviewed-by: David Gibson <address@hidden>
> ---
> backends/hostmem-file.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
> index e64074954f..639c8d4307 100644
> --- a/backends/hostmem-file.c
> +++ b/backends/hostmem-file.c
> @@ -145,20 +145,26 @@ static void file_memory_backend_set_pmem(Object *o,
> bool value, Error **errp)
> HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(o);
>
> if (host_memory_backend_mr_inited(backend)) {
> + char *path = object_get_canonical_path_component(o);
> +
> error_setg(errp, "cannot change property 'pmem' of %s '%s'",
> object_get_typename(o),
> - object_get_canonical_path_component(o));
> + path);
> + g_free(path);
> return;
> }
>
> #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;
> }
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature
- [Qemu-ppc] [PULL 00/45] Machine queue, 2018-10-18, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 01/45] hostmem-file: fixed the memory leak while get pmem path., Eduardo Habkost, 2018/10/18
- Re: [Qemu-ppc] [PULL 01/45] hostmem-file: fixed the memory leak while get pmem path.,
David Gibson <=
- [Qemu-ppc] [PULL 02/45] vl.c deprecate incorrect CPUs topology, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 03/45] vl:c: make sure that sockets are calculated correctly in '-smp X' case, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 04/45] numa: Fix QMP command set-numa-node error handling, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 05/45] trace-events: Fix copy/paste typo, Eduardo Habkost, 2018/10/18
- [Qemu-ppc] [PULL 06/45] hw/timer/sun4v-rtc: Convert from DPRINTF() macro to trace events, Eduardo Habkost, 2018/10/18