From 0923ea5beafe9792a65b4dbf10af53a606e86e43 Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Tue, 28 Nov 2017 16:24:13 +0100 Subject: [PATCH] lib/vfs/rump: safely destroy dir and file handles --- repos/dde_rump/src/lib/vfs/rump/vfs_rump.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/repos/dde_rump/src/lib/vfs/rump/vfs_rump.cc b/repos/dde_rump/src/lib/vfs/rump/vfs_rump.cc index 6215c6ec7c..dd929b54d7 100644 --- a/repos/dde_rump/src/lib/vfs/rump/vfs_rump.cc +++ b/repos/dde_rump/src/lib/vfs/rump/vfs_rump.cc @@ -527,11 +527,11 @@ class Vfs::Rump_file_system : public File_system void close(Vfs_handle *vfs_handle) override { - Rump_vfs_file_handle *rump_handle = - static_cast(vfs_handle); - - if (rump_handle) - destroy(vfs_handle->alloc(), rump_handle); + if (dynamic_cast(vfs_handle) + || dynamic_cast(vfs_handle)) { + destroy(vfs_handle->alloc(), vfs_handle); + return; + } } Stat_result stat(char const *path, Stat &stat)