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:
parent
ef4719ac17
commit
9c8753fe2f
@ -77,7 +77,7 @@ virSecurityDeviceLabelDefNew(const char *model)
|
|||||||
|
|
||||||
if (VIR_ALLOC(seclabel) < 0) {
|
if (VIR_ALLOC(seclabel) < 0) {
|
||||||
virSecurityDeviceLabelDefFree(seclabel);
|
virSecurityDeviceLabelDefFree(seclabel);
|
||||||
seclabel = NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
seclabel->model = g_strdup(model);
|
seclabel->model = g_strdup(model);
|
||||||
|
Loading…
Reference in New Issue
Block a user