aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Harris <james.r.harris@intel.com>2023-05-24 01:46:52 -0700
committerGitHub <noreply@github.com>2023-05-24 09:46:52 +0100
commite817d2e67835a80761fd33c4a1ed445c3309f3e7 (patch)
treec63fe6c2bc956d241c968d6d697b4843a8de7aa1
parent9fc7cc262f4bf6ae09af82efe59cbea7f7e330d7 (diff)
downloadlibvfio-user-e817d2e67835a80761fd33c4a1ed445c3309f3e7.zip
libvfio-user-e817d2e67835a80761fd33c4a1ed445c3309f3e7.tar.gz
libvfio-user-e817d2e67835a80761fd33c4a1ed445c3309f3e7.tar.bz2
test: don't leave global pointing to stack memory (#735)
test_device_is_stopped_and_copying points the global vfu_ctx structure to a local stack-allocated data structure. This is fine while the function is executing, but newer gcc complains that the pointer is left there after it returns. So clear the pointer to NULL before returning. Fixes issue #734. Reported-by: Kamil Godzwon <kamilx.godzwon@intel.com> Signed-off-by: Jim Harris <james.r.harris@intel.com>
-rw-r--r--test/unit-tests.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/unit-tests.c b/test/unit-tests.c
index 26ad304..0fd4fe7 100644
--- a/test/unit-tests.c
+++ b/test/unit-tests.c
@@ -601,6 +601,7 @@ test_device_is_stopped_and_copying(UNUSED void **state)
assert_false(r);
}
}
+ vfu_ctx.migration = NULL;
}
static void