]> git.proxmox.com Git - mirror_qemu.git/commit - exec.c
exec: Fix file_ram_alloc() error API violations
authorMarkus Armbruster <armbru@redhat.com>
Wed, 4 Dec 2019 09:36:12 +0000 (10:36 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Wed, 18 Dec 2019 07:36:15 +0000 (08:36 +0100)
commit56e477a56399c4e6d7fc0f6227fd9c475f83a8ce
treeac9b26e93d91996395aabb618e4f8efd22c8a22d
parent53cb2fc859bef4116bb5e8ef9a80ca6c05963d6f
exec: Fix file_ram_alloc() error API violations

When os_mem_prealloc() fails, file_ram_alloc() calls qemu_ram_munmap()
and returns null.  Except it doesn't when its @errp argument is null,
because it checks for failure with (errp && *errp).  Introduced in
commit 056b68af77 "fix qemu exit on memory hotplug when allocation
fails at prealloc time".

No caller actually passes null.

Fix anyway: splice in a local Error *err, and error_propagate().

Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20191204093625.14836-6-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
exec.c