]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: use VIR_APPEND_ELEMENT in virDomainDefAddImplicitVideo
authorJán Tomko <jtomko@redhat.com>
Mon, 11 Apr 2016 13:28:29 +0000 (15:28 +0200)
committerCole Robinson <crobinso@redhat.com>
Mon, 16 May 2016 13:19:44 +0000 (09:19 -0400)
(cherry picked from commit 1278688921b5721b6b9af63899fad0310f63b979)

src/conf/domain_conf.c

index 364615a9151623774d1c3a89ed52828604f57c61..f76fd074841adfa730020017bbbf777bb7cfe006 100644 (file)
@@ -18585,10 +18585,8 @@ virDomainDefAddImplicitVideo(virDomainDefPtr def)
     }
     video->vram = virDomainVideoDefaultRAM(def, video->type);
     video->heads = 1;
-    if (VIR_ALLOC_N(def->videos, 1) < 0)
+    if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, video) < 0)
         goto cleanup;
-    def->videos[def->nvideos++] = video;
-    video = NULL;
 
     ret = 0;
  cleanup: