Delete pointer and content, possible memory leak
authorRomain Forlot <romain.forlot@iot.bzh>
Thu, 1 Jun 2017 13:58:44 +0000 (15:58 +0200)
committerRomain Forlot <romain.forlot@iot.bzh>
Thu, 1 Jun 2017 16:40:13 +0000 (18:40 +0200)
Change-Id: I21e65bcaaa444c03bbc634f1d437e6ff363623b6
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp

index 826d26b..8ed8a78 100644 (file)
@@ -458,6 +458,11 @@ active_diagnostic_request_t* diagnostic_manager_t::add_recurring_request(Diagnos
 
                        entry->set_handle(shims_, request);
                        if(create_rx_filter(OBD2_FUNCTIONAL_BROADCAST_ID, frequencyHz) < 0)
+                       {
+                               recurring_requests_.pop_back();
+                               delete entry;
+                               entry = nullptr;
+                       }
                        else
                                {
                                        start_diagnostic_request(&shims_, entry->get_handle());