aboutsummaryrefslogtreecommitdiff
path: root/lib/libvmmapi
diff options
context:
space:
mode:
authorRobert Wing <rew@FreeBSD.org>2021-03-11 19:27:43 +0000
committerRobert Wing <rew@FreeBSD.org>2021-05-11 23:11:52 +0000
commita7f81b488df2d4a5dcd785b4112e04ffb6ca0442 (patch)
treec940f505a21c3d08e560d3b4b7b109a1da2448be /lib/libvmmapi
parentb2ae176d914acd63247e24d7e23dbe8f239fbfb0 (diff)
Diffstat (limited to 'lib/libvmmapi')
-rw-r--r--lib/libvmmapi/vmmapi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c
index 7faa2fc545ea..5810274c9a73 100644
--- a/lib/libvmmapi/vmmapi.c
+++ b/lib/libvmmapi/vmmapi.c
@@ -118,6 +118,7 @@ struct vmctx *
vm_open(const char *name)
{
struct vmctx *vm;
+ int saved_errno;
vm = malloc(sizeof(struct vmctx) + strlen(name) + 1);
assert(vm != NULL);
@@ -133,7 +134,9 @@ vm_open(const char *name)
return (vm);
err:
+ saved_errno = errno;
free(vm);
+ errno = saved_errno;
return (NULL);
}