libvirt/0002-conf-use-VIR_APPEND_EL...

26 lines
864 B
Diff

From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Mon, 11 Apr 2016 15:28:29 +0200
Subject: [PATCH] conf: use VIR_APPEND_ELEMENT in virDomainDefAddImplicitVideo
(cherry picked from commit 1278688921b5721b6b9af63899fad0310f63b979)
---
src/conf/domain_conf.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7c8fa4e..7497f20 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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: