]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
openvz: Check errors from virSocketAddrFormat
authorJohn Ferlan <jferlan@redhat.com>
Fri, 9 Jan 2015 15:48:37 +0000 (10:48 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 12 Jan 2015 13:59:55 +0000 (08:59 -0500)
Commit id 'a4e86390' modified the command line to allow --ipadd multiple
times; however, it did not account for the condition where a NULL is
returned which will could lead to some interesting errors with multiple
--ipadd's without parameters.

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/openvz/openvz_driver.c

index 64f5219fd9408e7467c49ecc209bc5d989ea50c0..17919bea672f919028d1a6eb894f29b8371838c0 100644 (file)
@@ -910,6 +910,8 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
         /* --ipadd ip */
         for (i = 0; i < net->nips; i++) {
             char *ipStr = virSocketAddrFormat(&net->ips[i]->address);
+            if (!ipStr)
+                goto cleanup;
             virCommandAddArgList(cmd, "--ipadd", ipStr, NULL);
             VIR_FREE(ipStr);
         }