[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt PATCH 3/4] tests: use g_new0 instead of VIR_ALLOC_N

On a Wednesday in 2020, Peter Krempa wrote:
On Wed, Sep 23, 2020 at 01:04:17 +0200, Ján Tomko wrote:
Signed-off-by: Ján Tomko <jtomko redhat com>


diff --git a/tests/securityselinuxtest.c b/tests/securityselinuxtest.c
index ae4b08b9d8..fd746d1ca1 100644
--- a/tests/securityselinuxtest.c
+++ b/tests/securityselinuxtest.c
@@ -71,8 +71,7 @@ testBuildDomainDef(bool dynamic,
         goto error;

     def->virtType = VIR_DOMAIN_VIRT_KVM;
-    if (VIR_ALLOC_N(def->seclabels, 1) < 0)
-        goto error;
+    def->seclabels = g_new0(char, 1);

'def' is virDomainDefPtr thus 'def->seclabels' is not char but 'virSecurityLabelDefPtr *'

:neutral_face: :palm_tree:

The compiler didn't moan because it's a double pointer, but it certainly
doens't have enough size nor the correct type.

Actually, the compiler did not even open this file.
v2 coming up


     if (VIR_ALLOC(secdef) < 0)
         goto error;

Attachment: signature.asc
Description: PGP signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]