diff mbox

[3/4] quorum: Fix leak of opts in quorum_open

Message ID 1409119356-22742-4-git-send-email-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng Aug. 27, 2014, 6:02 a.m. UTC
Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/quorum.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Benoît Canet Aug. 27, 2014, 2:36 p.m. UTC | #1
The Wednesday 27 Aug 2014 à 14:02:35 (+0800), Fam Zheng wrote :
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block/quorum.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/block/quorum.c b/block/quorum.c
> index 0de07bb..ffe8bd9 100644
> --- a/block/quorum.c
> +++ b/block/quorum.c
> @@ -796,7 +796,7 @@ static int quorum_open(BlockDriverState *bs, QDict *options, int flags,
>  {
>      BDRVQuorumState *s = bs->opaque;
>      Error *local_err = NULL;
> -    QemuOpts *opts;
> +    QemuOpts *opts = NULL;
>      bool *opened;
>      QDict *sub = NULL;
>      QList *list = NULL;
> @@ -908,6 +908,7 @@ close_exit:
>      g_free(s->bs);
>      g_free(opened);
>  exit:
> +    qemu_opts_del(opts);
>      /* propagate error */
>      if (local_err) {
>          error_propagate(errp, local_err);
> -- 
> 2.1.0
> 
> 
Reviewed-by: Benoît Canet <benoit.canet@nodalink.com>
diff mbox

Patch

diff --git a/block/quorum.c b/block/quorum.c
index 0de07bb..ffe8bd9 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -796,7 +796,7 @@  static int quorum_open(BlockDriverState *bs, QDict *options, int flags,
 {
     BDRVQuorumState *s = bs->opaque;
     Error *local_err = NULL;
-    QemuOpts *opts;
+    QemuOpts *opts = NULL;
     bool *opened;
     QDict *sub = NULL;
     QList *list = NULL;
@@ -908,6 +908,7 @@  close_exit:
     g_free(s->bs);
     g_free(opened);
 exit:
+    qemu_opts_del(opts);
     /* propagate error */
     if (local_err) {
         error_propagate(errp, local_err);