Re: [PATCH 04/14] qemu: Factor out body of qemuDomainSetMetadata for universal use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/10/2013 04:15 AM, Peter Krempa wrote:
> The function impelemnted common behavior that can be reused for other

s/impelemnted/implemented/

> hypervisor drivers that use the virDomainObj data structures. Factor out
> the core into a separate helper func.
> ---
>  src/conf/domain_conf.c   | 85 ++++++++++++++++++++++++++++++++++++++++++++++++
>  src/conf/domain_conf.h   | 10 ++++++
>  src/libvirt_private.syms |  1 +
>  src/qemu/qemu_driver.c   | 73 ++++-------------------------------------
>  4 files changed, 103 insertions(+), 66 deletions(-)
> 

> +
> +    if (flags & VIR_DOMAIN_AFFECT_LIVE) {
> +        switch ((virDomainMetadataType) type) {
> +        case VIR_DOMAIN_METADATA_DESCRIPTION:
> +            VIR_FREE(vm->def->description);
> +            if (VIR_STRDUP(vm->def->description, metadata) < 0)
> +                goto cleanup;

Pre-existing - but should we do the VIR_STRDUP into a temporary before
freeing the original, and only replace on success, so that at least on
an OOM situation we still leave the older string in vm->def rather than
losing both strings?  On the other hand, OOM recovery is best effort,
and someone should already be prepared for weird things to have happened
to their guest.  Certainly not something to change in this patch.

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]