discover: Ensure destroy_device is called on reinit
authorSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Thu, 21 May 2015 06:30:07 +0000 (16:30 +1000)
committerSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Thu, 6 Aug 2015 04:08:09 +0000 (14:08 +1000)
Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
discover/device-handler.c

index 64095f10d723c41f702caa2d3a9fcd2d0754eed1..d2b50b5e36c3e170ad478ca12bbd93e819fcef50 100644 (file)
@@ -330,9 +330,11 @@ void device_handler_reinit(struct device_handler *handler)
        list_init(&handler->unresolved_boot_options);
 
        /* drop all devices */
-       for (i = 0; i < handler->n_devices; i++)
+       for (i = 0; i < handler->n_devices; i++) {
                discover_server_notify_device_remove(handler->server,
                                handler->devices[i]->device);
+               talloc_free(handler->devices[i]);
+       }
 
        talloc_free(handler->devices);
        handler->devices = NULL;