[libvirt PATCH 3/4] tests: use g_new0 instead of VIR_ALLOC_N
Ján Tomko
jtomko at redhat.com
Wed Sep 23 13:04:22 UTC 2020
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 at 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
Jano
>>
>> if (VIR_ALLOC(secdef) < 0)
>> goto error;
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200923/6aecb80c/attachment-0001.sig>
More information about the libvir-list
mailing list