Message ID | 7328fb16c394eaf5d65437d11c2a9343647b6d3d.1535471899.git.yi.z.zhang@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/1] hostmem-file: fixed the memory leak while get pmem path. | expand |
On Wed, Aug 29, 2018 at 12:14:22AM +0800, Zhang Yi wrote: > object_get_canonical_path_component() returns a string which > must be freed using g_free(). > > Reported-by: Peter Maydell <peter.maydell@linaro.org> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > Signed-off-by: Zhang Yi <yi.z.zhang@linux.intel.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Queueing on machine-next, thanks.
On 29 August 2018 at 18:50, Eduardo Habkost <ehabkost@redhat.com> wrote: > On Wed, Aug 29, 2018 at 12:14:22AM +0800, Zhang Yi wrote: >> object_get_canonical_path_component() returns a string which >> must be freed using g_free(). >> >> Reported-by: Peter Maydell <peter.maydell@linaro.org> >> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> >> Signed-off-by: Zhang Yi <yi.z.zhang@linux.intel.com> > > Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> > > Queueing on machine-next, thanks. Ping? This patch doesn't seem to have made it to master... thanks -- PMM
On Tue, Oct 16, 2018 at 12:55:08PM +0100, Peter Maydell wrote: > On 29 August 2018 at 18:50, Eduardo Habkost <ehabkost@redhat.com> wrote: > > On Wed, Aug 29, 2018 at 12:14:22AM +0800, Zhang Yi wrote: > >> object_get_canonical_path_component() returns a string which > >> must be freed using g_free(). > >> > >> Reported-by: Peter Maydell <peter.maydell@linaro.org> > >> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > >> Signed-off-by: Zhang Yi <yi.z.zhang@linux.intel.com> > > > > Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> > > > > Queueing on machine-next, thanks. > > Ping? This patch doesn't seem to have made it to master... Sorry for the delay. I have a few patches queued on machine-next that I will include in a pull request this week (today or tomorrow).
diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index 2476dcb..e8831a8 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; }