1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00

virSecurityDeviceLabelDefNew: Avoid NULL dereference

While it is impossible for VIR_ALLOC() to return an error, we
should be consistent with the rest of the code and not continue
initializing the virSecurityDeviceLabelDef structure.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Michal Privoznik 2020-03-30 10:56:46 +02:00
parent ef4719ac17
commit 9c8753fe2f

View File

@ -77,7 +77,7 @@ virSecurityDeviceLabelDefNew(const char *model)
if (VIR_ALLOC(seclabel) < 0) {
virSecurityDeviceLabelDefFree(seclabel);
seclabel = NULL;
return NULL;
}
seclabel->model = g_strdup(model);