Add service set destructor.
authorDavin McCall <davmac@davmac.org>
Fri, 29 Sep 2017 19:26:05 +0000 (20:26 +0100)
committerDavin McCall <davmac@davmac.org>
Sat, 30 Sep 2017 01:51:12 +0000 (02:51 +0100)
Destructor deletes all services in the service set. This fixes a memory
leak currently present in the tests.

src/service.h

index b9c84711812149250e2c5439d08199e9c89c18e6..8a193704bad9762bf02dfc35d60ebac89b1f89a6 100644 (file)
@@ -817,6 +817,13 @@ class service_set
         restart_enabled = true;
     }
     
+    virtual ~service_set()
+    {
+        for (auto * s : records) {
+            delete s;
+        }
+    }
+
     // Start the specified service. The service will be marked active.
     void start_service(service_record *svc)
     {