mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
virFirewallApply: Fix possible NULL dereference on error
Commit bbc25f0d03
juggled around some
error reporting. Unfortunately virFirewallApply tries to report the
errno stored in the firewall object and we'd try to do that when the
firewall object is NULL too. Report EINVAL if 'firewall' is NULL.
Found by Coverity.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
1553e72567
commit
0a3d0c610a
@ -766,8 +766,12 @@ virFirewallApply(virFirewallPtr firewall)
|
||||
goto cleanup;
|
||||
}
|
||||
if (!firewall || firewall->err) {
|
||||
virReportSystemError(firewall->err, "%s",
|
||||
_("Unable to create rule"));
|
||||
int err = EINVAL;
|
||||
|
||||
if (firewall)
|
||||
err = firewall->err;
|
||||
|
||||
virReportSystemError(err, "%s", _("Unable to create rule"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user