efi_driver: set DM_FLAG_NAME_ALLOCED flag
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 30 Jun 2018 05:11:32 +0000 (07:11 +0200)
committerAlexander Graf <agraf@suse.de>
Wed, 25 Jul 2018 12:59:44 +0000 (14:59 +0200)
Set the DM_FLAG_NAME_ALLOCED flag to avoid a memory leak when the block
device is removed.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
lib/efi_driver/efi_block_device.c

index 9c807ff71dffcc6b825d2481a1ae760bbd384fa5..5b9c139f3892ea4b9af29a58d5c7333a04d158ed 100644 (file)
@@ -161,6 +161,8 @@ static int efi_bl_bind(efi_handle_t handle, void *interface)
                return ret;
        if (!bdev)
                return -ENOENT;
+       /* Set the DM_FLAG_NAME_ALLOCED flag to avoid a memory leak */
+       device_set_name_alloced(bdev);
        /* Allocate priv */
        ret = device_probe(bdev);
        if (ret)