[libvirt] [PATCH 02/10] Check and handle error for virAsprintf() calls. Ignore the return in parallelsMakePoolName() since subsequent check validates name was allocated.

Daniel P. Berrange berrange at redhat.com
Thu Jan 3 19:32:58 UTC 2013


NB, you should restrict the first line of the commit message to
approx 70 characters. Then have a single blank line, followed
by the longer description. This ensures that you get sensible
subject lines :-)

On Thu, Jan 03, 2013 at 02:16:14PM -0500, John Ferlan wrote:
> ---
>  src/parallels/parallels_storage.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/src/parallels/parallels_storage.c b/src/parallels/parallels_storage.c
> index e768d88..2908bee 100644
> --- a/src/parallels/parallels_storage.c
> +++ b/src/parallels/parallels_storage.c
> @@ -146,7 +146,7 @@ static char *parallelsMakePoolName(virConnectPtr conn, const char *path)
>          if (i == 0)
>              name = strdup(path);
>          else
> -            virAsprintf(&name, "%s-%u", path, i);
> +            ignore_value(virAsprintf(&name, "%s-%u", path, i));
>  
>          if (!name) {
>              virReportOOMError();
> @@ -310,8 +310,7 @@ static int parallelsAddDiskVolume(virStoragePoolObjPtr pool,
>      if (VIR_ALLOC(def))
>          goto no_memory;
>  
> -    virAsprintf(&def->name, "%s-%s", dom->def->name, diskName);
> -    if (!def->name)
> +    if (virAsprintf(&def->name, "%s-%s", dom->def->name, diskName) < 0)
>          goto no_memory;
>  
>      def->type = VIR_STORAGE_VOL_FILE;

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