[libvirt] [PATCH 08/10] Check and handle error for virAsprintf() calls.

Daniel P. Berrange berrange at redhat.com
Thu Jan 3 19:37:22 UTC 2013


On Thu, Jan 03, 2013 at 02:16:20PM -0500, John Ferlan wrote:
> ---
>  tests/xml2vmxtest.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
> index 653ab6c..c578109 100644
> --- a/tests/xml2vmxtest.c
> +++ b/tests/xml2vmxtest.c
> @@ -193,8 +193,9 @@ testFormatVMXFileName(const char *src, void *opaque ATTRIBUTE_UNUSED)
>              directoryAndFileName += strspn(directoryAndFileName, " ");
>          }
>  
> -        virAsprintf(&absolutePath, "/vmfs/volumes/%s/%s", datastoreName,
> -                    directoryAndFileName);
> +        if (virAsprintf(&absolutePath, "/vmfs/volumes/%s/%s", datastoreName,
> +                        directoryAndFileName) < 0)
> +            goto cleanup;
>      } else if (STRPREFIX(src, "/")) {
>          /* Found absolute path */
>          absolutePath = strdup(src);

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




More information about the libvir-list mailing list