diff --git a/libfprint/drivers/virtual-device-storage.c b/libfprint/drivers/virtual-device-storage.c index 355f495..c948a6b 100644 --- a/libfprint/drivers/virtual-device-storage.c +++ b/libfprint/drivers/virtual-device-storage.c @@ -167,6 +167,16 @@ fpi_device_virtual_device_storage_init (FpDeviceVirtualDeviceStorage *self) NULL); } +static void +fpi_device_virtual_device_storage_finalize (GObject *object) +{ + FpDeviceVirtualDevice *vdev = FP_DEVICE_VIRTUAL_DEVICE (object); + + G_DEBUG_HERE (); + g_clear_pointer (&vdev->prints_storage, g_hash_table_destroy); + G_OBJECT_CLASS (fpi_device_virtual_device_storage_parent_class)->finalize (object); +} + static const FpIdEntry driver_ids[] = { { .virtual_envvar = "FP_VIRTUAL_DEVICE_STORAGE" }, { .virtual_envvar = "FP_VIRTUAL_DEVICE_IDENT" }, @@ -177,6 +187,9 @@ static void fpi_device_virtual_device_storage_class_init (FpDeviceVirtualDeviceStorageClass *klass) { FpDeviceClass *dev_class = FP_DEVICE_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = fpi_device_virtual_device_storage_finalize; dev_class->id = FP_COMPONENT; dev_class->full_name = "Virtual device with storage and identification for debugging"; diff --git a/libfprint/drivers/virtual-device.c b/libfprint/drivers/virtual-device.c index 5f193d6..03453b0 100644 --- a/libfprint/drivers/virtual-device.c +++ b/libfprint/drivers/virtual-device.c @@ -419,7 +419,11 @@ dev_deinit (FpDevice *dev) static void fpi_device_virtual_device_finalize (GObject *object) { + FpDeviceVirtualDevice *self = FP_DEVICE_VIRTUAL_DEVICE (object); + G_DEBUG_HERE (); + g_clear_pointer (&self->pending_commands, g_ptr_array_unref); + G_OBJECT_CLASS (fpi_device_virtual_device_parent_class)->finalize (object); } static void