]> xenbits.xensource.com Git - libvirt.git/commitdiff
vmx: Use the allocator virDomainChrDefNew
authorJohn Ferlan <jferlan@redhat.com>
Fri, 21 Oct 2016 12:09:51 +0000 (08:09 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 21 Oct 2016 18:03:30 +0000 (14:03 -0400)
Rather than VIR_ALLOC of the virDomainChrDefPtr

src/conf/domain_conf.c
src/vmx/vmx.c

index 89473db2cc898adb701073b73355522759d0f66d..f3b0ca94e7a6ce9fcd6f0e82f78a3adc2a36c08f 100644 (file)
@@ -3874,7 +3874,7 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def)
 
         if (!def->consoles[0]) {
             /* allocate a new console type for the stolen one */
-            if (VIR_ALLOC(def->consoles[0]) < 0)
+            if (!(def->consoles[0] = virDomainChrDefNew(NULL)))
                 return -1;
 
             /* Create an console alias for the serial port */
@@ -3889,7 +3889,7 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def)
          *                or has a different type than SERIAL or NONE.
          */
         virDomainChrDefPtr chr;
-        if (VIR_ALLOC(chr) < 0)
+        if (!(chr = virDomainChrDefNew(NULL)))
             return -1;
 
         if (VIR_INSERT_ELEMENT(def->consoles,
index fc4347f9b5f8d6f5fdba482e18cdc4bf65af1219..f61c4d6c489dc9ed1df0fb83cba3e22ec1938153 100644 (file)
@@ -2758,7 +2758,7 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
         return -1;
     }
 
-    if (VIR_ALLOC(*def) < 0)
+    if (!(*def = virDomainChrDefNew(NULL)))
         return -1;
 
     (*def)->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
@@ -2946,7 +2946,7 @@ virVMXParseParallel(virVMXContext *ctx, virConfPtr conf, int port,
         return -1;
     }
 
-    if (VIR_ALLOC(*def) < 0)
+    if (!(*def = virDomainChrDefNew(NULL)))
         return -1;
 
     (*def)->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL;