From c2cf0ae8c617fe6de9079ef1a6585daa9f291258 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 13 Mar 2020 19:34:53 +0100 Subject: [PATCH] os/vfs.h: fix possible nullptr dereference Fixes #3694 --- repos/os/include/os/vfs.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/repos/os/include/os/vfs.h b/repos/os/include/os/vfs.h index 1c09d21ce..501a94f09 100644 --- a/repos/os/include/os/vfs.h +++ b/repos/os/include/os/vfs.h @@ -613,7 +613,11 @@ class Genode::Watcher _watch(fs, alloc, rel_path, handler); } - ~Watcher() { _handle->fs().close(_handle); } + ~Watcher() + { + if (_handle) + _handle->fs().close(_handle); + } };