From 4fa142e10ae84b022e33ca06b5af0f87ce0d1ae4 Mon Sep 17 00:00:00 2001 From: Javier Santiago Date: Wed, 13 Jul 2022 09:30:49 +0200 Subject: [PATCH] Set nullptr after delete Signed-off-by: Javier Santiago --- rmw_fastrtps_shared_cpp/src/rmw_service.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rmw_fastrtps_shared_cpp/src/rmw_service.cpp b/rmw_fastrtps_shared_cpp/src/rmw_service.cpp index 056adc83c..51af59baf 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_service.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_service.cpp @@ -109,6 +109,7 @@ __rmw_destroy_service( // Delete DataReader listener if (nullptr != info->listener_) { delete info->listener_; + info->listener_ = nullptr; } // Delete DataWriter @@ -122,6 +123,7 @@ __rmw_destroy_service( // Delete DataWriter listener if (nullptr != info->pub_listener_) { delete info->pub_listener_; + info->pub_listener_ = nullptr; } // Delete topics and unregister types