aboutsummaryrefslogtreecommitdiff
path: root/samples/gpio-pci-idio-16.c
diff options
context:
space:
mode:
Diffstat (limited to 'samples/gpio-pci-idio-16.c')
-rw-r--r--samples/gpio-pci-idio-16.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/samples/gpio-pci-idio-16.c b/samples/gpio-pci-idio-16.c
index 4872d3b..b50f407 100644
--- a/samples/gpio-pci-idio-16.c
+++ b/samples/gpio-pci-idio-16.c
@@ -243,6 +243,9 @@ main(int argc, char *argv[])
ret = vfu_attach_ctx(vfu_ctx);
if (ret < 0) {
+ int _errno = errno;
+ vfu_destroy_ctx(vfu_ctx);
+ errno = _errno;
err(EXIT_FAILURE, "failed to attach device");
}