HappenLee commented on code in PR #25798:
URL: https://github.com/apache/doris/pull/25798#discussion_r1369145939


##########
be/src/agent/topic_subscriber.cpp:
##########
@@ -29,37 +29,41 @@ namespace doris {
 TopicSubscriber::TopicSubscriber() {}
 
 TopicSubscriber::~TopicSubscriber() {
-    // Delete all listeners in the register
-    std::map<TTopicType::type, std::vector<TopicListener*>>::iterator it =
-            _registered_listeners.begin();
-    for (; it != _registered_listeners.end(); ++it) {
-        std::vector<TopicListener*>& listeners = it->second;
-        std::vector<TopicListener*>::iterator listener_it = listeners.begin();
-        for (; listener_it != listeners.end(); ++listener_it) {
-            delete *listener_it;
-        }
+    auto iter = _registered_listeners.begin();
+    for (; iter != _registered_listeners.end(); iter++) {
+        delete iter->second;

Review Comment:
   better use unique_ptr ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to