Re: [Qemu-devel] [PATCH v3 1/6] migration: fix vmdesc leak on vmstate_save() error
* Marc-André Lureau (marcandre.lur...@redhat.com) wrote: > Signed-off-by: Marc-André Lureau I've queued this 1/6 only. > --- > migration/qjson.h | 2 ++ > migration/savevm.c | 3 +-- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/migration/qjson.h b/migration/qjson.h > index 41664f2d71..1786bb5864 100644 > --- a/migration/qjson.h > +++ b/migration/qjson.h > @@ -24,4 +24,6 @@ void json_start_object(QJSON *json, const char *name); > const char *qjson_get_str(QJSON *json); > void qjson_finish(QJSON *json); > > +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QJSON, qjson_destroy) > + > #endif /* QEMU_QJSON_H */ > diff --git a/migration/savevm.c b/migration/savevm.c > index 4a86128ac4..6caa35a679 100644 > --- a/migration/savevm.c > +++ b/migration/savevm.c > @@ -1290,7 +1290,7 @@ int > qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f, > bool in_postcopy, > bool inactivate_disks) > { > -QJSON *vmdesc; > +g_autoptr(QJSON) vmdesc = NULL; > int vmdesc_len; > SaveStateEntry *se; > int ret; > @@ -1351,7 +1351,6 @@ int > qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f, > qemu_put_be32(f, vmdesc_len); > qemu_put_buffer(f, (uint8_t *)qjson_get_str(vmdesc), vmdesc_len); > } > -qjson_destroy(vmdesc); > > return 0; > } > -- > 2.23.0 > > -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
Re: [Qemu-devel] [PATCH v3 1/6] migration: fix vmdesc leak on vmstate_save() error
On Thu, Sep 12, 2019 at 04:25:09PM +0400, Marc-André Lureau wrote: > Signed-off-by: Marc-André Lureau > --- > migration/qjson.h | 2 ++ > migration/savevm.c | 3 +-- > 2 files changed, 3 insertions(+), 2 deletions(-) Reviewed-by: Daniel P. Berrangé Regards, Daniel -- |: https://berrange.com -o-https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o-https://fstop138.berrange.com :| |: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|
Re: [Qemu-devel] [PATCH v3 1/6] migration: fix vmdesc leak on vmstate_save() error
* Marc-André Lureau (marcandre.lur...@redhat.com) wrote: > Signed-off-by: Marc-André Lureau Reviewed-by: Dr. David Alan Gilbert Could have put that as a separate patch. > --- > migration/qjson.h | 2 ++ > migration/savevm.c | 3 +-- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/migration/qjson.h b/migration/qjson.h > index 41664f2d71..1786bb5864 100644 > --- a/migration/qjson.h > +++ b/migration/qjson.h > @@ -24,4 +24,6 @@ void json_start_object(QJSON *json, const char *name); > const char *qjson_get_str(QJSON *json); > void qjson_finish(QJSON *json); > > +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QJSON, qjson_destroy) > + > #endif /* QEMU_QJSON_H */ > diff --git a/migration/savevm.c b/migration/savevm.c > index 4a86128ac4..6caa35a679 100644 > --- a/migration/savevm.c > +++ b/migration/savevm.c > @@ -1290,7 +1290,7 @@ int > qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f, > bool in_postcopy, > bool inactivate_disks) > { > -QJSON *vmdesc; > +g_autoptr(QJSON) vmdesc = NULL; > int vmdesc_len; > SaveStateEntry *se; > int ret; > @@ -1351,7 +1351,6 @@ int > qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f, > qemu_put_be32(f, vmdesc_len); > qemu_put_buffer(f, (uint8_t *)qjson_get_str(vmdesc), vmdesc_len); > } > -qjson_destroy(vmdesc); > > return 0; > } > -- > 2.23.0 > -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
[Qemu-devel] [PATCH v3 1/6] migration: fix vmdesc leak on vmstate_save() error
Signed-off-by: Marc-André Lureau --- migration/qjson.h | 2 ++ migration/savevm.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/migration/qjson.h b/migration/qjson.h index 41664f2d71..1786bb5864 100644 --- a/migration/qjson.h +++ b/migration/qjson.h @@ -24,4 +24,6 @@ void json_start_object(QJSON *json, const char *name); const char *qjson_get_str(QJSON *json); void qjson_finish(QJSON *json); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QJSON, qjson_destroy) + #endif /* QEMU_QJSON_H */ diff --git a/migration/savevm.c b/migration/savevm.c index 4a86128ac4..6caa35a679 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1290,7 +1290,7 @@ int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f, bool in_postcopy, bool inactivate_disks) { -QJSON *vmdesc; +g_autoptr(QJSON) vmdesc = NULL; int vmdesc_len; SaveStateEntry *se; int ret; @@ -1351,7 +1351,6 @@ int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f, qemu_put_be32(f, vmdesc_len); qemu_put_buffer(f, (uint8_t *)qjson_get_str(vmdesc), vmdesc_len); } -qjson_destroy(vmdesc); return 0; } -- 2.23.0