Re: [PATCH 8/8] add missing error handling to virGetDomain

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

 



On Sun, Feb 13, 2011 at 10:45:24PM +0100, Christophe Fergeau wrote:
> When creating the virDomain::snapshots hash table, virGetDomain
> wasn't checking if the creation was successful. This would then
> lead to failures in the vir*DomainSnapshot functions. Better to
> report this error early and make virGetDomain fail if the
> snapshots hash couldn't be created.
> ---
>  src/datatypes.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/src/datatypes.c b/src/datatypes.c
> index 4f7373c..7cc37c1 100644
> --- a/src/datatypes.c
> +++ b/src/datatypes.c
> @@ -359,6 +359,12 @@ virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) {
>          ret->id = -1;
>          memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN);
>          ret->snapshots = virHashCreate(20);
> +        if (ret->snapshots == NULL) {
> +            virMutexUnlock(&conn->lock);
> +            virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                            _("failed to create domain snapshots hash"));
> +            goto error;
> +        }
>  
>          if (virHashAddEntry(conn->domains, uuidstr, ret) < 0) {
>              virMutexUnlock(&conn->lock);

  ACK, and pushed, taht one should go in for 0.8.8 too.
The others which are more about refactoring and cleanups should wait a
bit until after the release,

  thanks !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
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]