Re: [PATCH 07/10] Check and handle error for virAsprintf() calls.

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

 



On Thu, Jan 03, 2013 at 02:16:19PM -0500, John Ferlan wrote:
> ---
>  tests/vmx2xmltest.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
> index 03a8989..2430350 100644
> --- a/tests/vmx2xmltest.c
> +++ b/tests/vmx2xmltest.c
> @@ -179,7 +179,9 @@ testParseVMXFileName(const char *fileName, void *opaque ATTRIBUTE_UNUSED)
>              goto cleanup;
>          }
>  
> -        virAsprintf(&src, "[%s] %s", datastoreName, directoryAndFileName);
> +        if (virAsprintf(&src, "[%s] %s", datastoreName,
> +                        directoryAndFileName) < 0)
> +            goto cleanup;
>      } else if (STRPREFIX(fileName, "/")) {
>          /* Found absolute path referencing a file outside a datastore */
>          src = strdup(fileName);
> @@ -188,7 +190,8 @@ testParseVMXFileName(const char *fileName, void *opaque ATTRIBUTE_UNUSED)
>          src = NULL;
>      } else {
>          /* Found single file name referencing a file inside a datastore */
> -        virAsprintf(&src, "[datastore] directory/%s", fileName);
> +        if (virAsprintf(&src, "[datastore] directory/%s", fileName) < 0)
> +            goto cleanup;
>      }
>  
>    cleanup:

ACK

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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