From 31eb96358fdfec5ea0ee807fc1583746b1ca9a0d Mon Sep 17 00:00:00 2001 From: Roman Bolshakov Date: Tue, 3 Nov 2020 17:26:28 +0300 Subject: [PATCH] virpcimock: Initialize real_close before using it real_close() is not inialized by the first invocation of close(). That causes an issue when the mock is used before others and a call of real_close() results in a jump to NULL pointer. Signed-off-by: Roman Bolshakov Reviewed-by: Andrea Bolognani --- tests/virpcimock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/virpcimock.c b/tests/virpcimock.c index 064218d275..438cb7a672 100644 --- a/tests/virpcimock.c +++ b/tests/virpcimock.c @@ -1123,6 +1123,8 @@ opendir(const char *path) int close(int fd) { + init_syms(); + if (remove_fd(fd) < 0) return -1; return real_close(fd);