
On Wed, Jul 24, 2019 at 12:55:51AM -0500, Eric Blake wrote:
virDomainSnapshotFindByName(list, NULL) should return NULL, rather than the internal-use-only metaroot. Most existing callers pass in a non-NULL name; the few that don't are immediately calling virDomainMomentSetParent (which indeed needs the metaroot if the parent name is NULL); but as the leak is ugly, it is worth instead making virDomainMomentSetParent static and adding a new function for resolving the link of a brand new moment within its list (and where we are either requesting NULL for a new root moment, or requesting the name of the current moment, and therefore the new function does not need to return failure, but merely warn if future code breaks our assumptions).
Missed when commit 02c4e24d refactored things to attempt to remove direct metaroot manipulations out of the qemu and test drivers into internal-only details, and made more obvious when commit dc8d3dc6 factored it out into a separate file.
Signed-off-by: Eric Blake <eblake@redhat.com> --- src/conf/virdomainmomentobjlist.h | 4 ++-- src/conf/virdomainsnapshotobjlist.h | 2 ++ src/conf/virdomainmomentobjlist.c | 34 +++++++++++++++++++++++++---- src/conf/virdomainsnapshotobjlist.c | 9 ++++++++ src/libvirt_private.syms | 2 +- src/qemu/qemu_driver.c | 5 +---- src/test/test_driver.c | 5 +---- 7 files changed, 46 insertions(+), 15 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|