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 <r.bolsha...@yadro.com>
---
 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);
-- 
2.28.0


Reply via email to