block/blkdebug: fix memory leak

Spotted by PVS-Studio

Signed-off-by: Elena Afanasova <eafanasova@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1e903f928eb3da332cc95e2a6f87243bd9fe66e4.camel@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
Elena Afanasova 2020-10-09 12:09:59 -07:00 committed by Laurent Vivier
parent 3298bbce1b
commit 5b4c95d0a3

View File

@ -215,6 +215,7 @@ static int add_rule(void *opaque, QemuOpts *opts, Error **errp)
BLKDEBUG_IO_TYPE__MAX, &local_error); BLKDEBUG_IO_TYPE__MAX, &local_error);
if (local_error) { if (local_error) {
error_propagate(errp, local_error); error_propagate(errp, local_error);
g_free(rule);
return -1; return -1;
} }
if (iotype != BLKDEBUG_IO_TYPE__MAX) { if (iotype != BLKDEBUG_IO_TYPE__MAX) {