OSDN Git Service

blockdev: Fix a memleak in drive_backup_prepare()
authorPan Nengyuan <pannengyuan@huawei.com>
Fri, 23 Oct 2020 06:12:17 +0000 (14:12 +0800)
committerLaurent Vivier <laurent@vivier.eu>
Sun, 13 Dec 2020 22:56:16 +0000 (23:56 +0100)
'local_err' seems forgot to propagate in error path, it'll cause
a memleak. Fix it.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Message-Id: <20201023061218.2080844-7-kuhn.chenqun@huawei.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
blockdev.c

index 412354b..2431448 100644 (file)
@@ -1827,6 +1827,7 @@ static void drive_backup_prepare(BlkActionState *common, Error **errp)
     if (set_backing_hd) {
         bdrv_set_backing_hd(target_bs, source, &local_err);
         if (local_err) {
+            error_propagate(errp, local_err);
             goto unref;
         }
     }