qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/4] block: Fix leaks of opts in block drivers
@ 2014-08-27  6:02 Fam Zheng
  2014-08-27  6:02 ` [Qemu-devel] [PATCH 1/4] nfs: Fix leak of opts in nfs_file_open Fam Zheng
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Fam Zheng @ 2014-08-27  6:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi

Remember to call qemu_opts_del before function returning.


Fam Zheng (4):
  nfs: Fix leak of opts in nfs_file_open
  blkverify: Fix leak of opts in blkverify_open
  quorum: Fix leak of opts in quorum_open
  qcow2: Fix leak of opts in qcow2_open

 block/blkverify.c | 1 +
 block/nfs.c       | 7 +++++--
 block/qcow2.c     | 5 ++---
 block/quorum.c    | 3 ++-
 4 files changed, 10 insertions(+), 6 deletions(-)

-- 
2.1.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 1/4] nfs: Fix leak of opts in nfs_file_open
  2014-08-27  6:02 [Qemu-devel] [PATCH 0/4] block: Fix leaks of opts in block drivers Fam Zheng
@ 2014-08-27  6:02 ` Fam Zheng
  2014-08-27 14:46   ` Benoît Canet
  2014-08-27  6:02 ` [Qemu-devel] [PATCH 2/4] blkverify: Fix leak of opts in blkverify_open Fam Zheng
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Fam Zheng @ 2014-08-27  6:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/nfs.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/block/nfs.c b/block/nfs.c
index 93d87f3..36e8057 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -393,15 +393,18 @@ static int nfs_file_open(BlockDriverState *bs, QDict *options, int flags,
     qemu_opts_absorb_qdict(opts, options, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
-        return -EINVAL;
+        ret = -EINVAL;
+        goto out;
     }
     ret = nfs_client_open(client, qemu_opt_get(opts, "filename"),
                           (flags & BDRV_O_RDWR) ? O_RDWR : O_RDONLY,
                           errp);
     if (ret < 0) {
-        return ret;
+        goto out;
     }
     bs->total_sectors = ret;
+out:
+    qemu_opts_del(opts);
     return 0;
 }
 
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 2/4] blkverify: Fix leak of opts in blkverify_open
  2014-08-27  6:02 [Qemu-devel] [PATCH 0/4] block: Fix leaks of opts in block drivers Fam Zheng
  2014-08-27  6:02 ` [Qemu-devel] [PATCH 1/4] nfs: Fix leak of opts in nfs_file_open Fam Zheng
@ 2014-08-27  6:02 ` Fam Zheng
  2014-08-27 14:41   ` Benoît Canet
  2014-08-27  6:02 ` [Qemu-devel] [PATCH 3/4] quorum: Fix leak of opts in quorum_open Fam Zheng
  2014-08-27  6:02 ` [Qemu-devel] [PATCH 4/4] qcow2: Fix leak of opts in qcow2_open Fam Zheng
  3 siblings, 1 reply; 13+ messages in thread
From: Fam Zheng @ 2014-08-27  6:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/blkverify.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/blkverify.c b/block/blkverify.c
index 7c78ca4..163064c 100644
--- a/block/blkverify.c
+++ b/block/blkverify.c
@@ -158,6 +158,7 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
 
     ret = 0;
 fail:
+    qemu_opts_del(opts);
     return ret;
 }
 
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 3/4] quorum: Fix leak of opts in quorum_open
  2014-08-27  6:02 [Qemu-devel] [PATCH 0/4] block: Fix leaks of opts in block drivers Fam Zheng
  2014-08-27  6:02 ` [Qemu-devel] [PATCH 1/4] nfs: Fix leak of opts in nfs_file_open Fam Zheng
  2014-08-27  6:02 ` [Qemu-devel] [PATCH 2/4] blkverify: Fix leak of opts in blkverify_open Fam Zheng
@ 2014-08-27  6:02 ` Fam Zheng
  2014-08-27 14:36   ` Benoît Canet
  2014-08-27  6:02 ` [Qemu-devel] [PATCH 4/4] qcow2: Fix leak of opts in qcow2_open Fam Zheng
  3 siblings, 1 reply; 13+ messages in thread
From: Fam Zheng @ 2014-08-27  6:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 4/4] qcow2: Fix leak of opts in qcow2_open
  2014-08-27  6:02 [Qemu-devel] [PATCH 0/4] block: Fix leaks of opts in block drivers Fam Zheng
                   ` (2 preceding siblings ...)
  2014-08-27  6:02 ` [Qemu-devel] [PATCH 3/4] quorum: Fix leak of opts in quorum_open Fam Zheng
@ 2014-08-27  6:02 ` Fam Zheng
  2014-08-27 14:40   ` Benoît Canet
  2014-08-27 17:40   ` Max Reitz
  3 siblings, 2 replies; 13+ messages in thread
From: Fam Zheng @ 2014-08-27  6:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi

Not all the error paths release opts, fix it by moving it after the fail
label.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/qcow2.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/block/qcow2.c b/block/qcow2.c
index f9e045f..b4c4a6e 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -535,7 +535,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
     unsigned int len, i;
     int ret = 0;
     QCowHeader header;
-    QemuOpts *opts;
+    QemuOpts *opts = NULL;
     Error *local_err = NULL;
     uint64_t ext_end;
     uint64_t l1_vm_state_index;
@@ -932,7 +932,6 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
         error_setg(errp, "Unsupported value '%s' for qcow2 option "
                    "'overlap-check'. Allowed are either of the following: "
                    "none, constant, cached, all", opt_overlap_check);
-        qemu_opts_del(opts);
         ret = -EINVAL;
         goto fail;
     }
@@ -946,7 +945,6 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
                               overlap_check_template & (1 << i)) << i;
     }
 
-    qemu_opts_del(opts);
 
     if (s->use_lazy_refcounts && s->qcow_version < 3) {
         error_setg(errp, "Lazy refcounts require a qcow2 image with at least "
@@ -964,6 +962,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
     return ret;
 
  fail:
+    qemu_opts_del(opts);
     g_free(s->unknown_header_fields);
     cleanup_unknown_header_ext(bs);
     qcow2_free_snapshots(bs);
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 3/4] quorum: Fix leak of opts in quorum_open
  2014-08-27  6:02 ` [Qemu-devel] [PATCH 3/4] quorum: Fix leak of opts in quorum_open Fam Zheng
@ 2014-08-27 14:36   ` Benoît Canet
  0 siblings, 0 replies; 13+ messages in thread
From: Benoît Canet @ 2014-08-27 14:36 UTC (permalink / raw)
  To: Fam Zheng; +Cc: Kevin Wolf, qemu-devel, Stefan Hajnoczi

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>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 4/4] qcow2: Fix leak of opts in qcow2_open
  2014-08-27  6:02 ` [Qemu-devel] [PATCH 4/4] qcow2: Fix leak of opts in qcow2_open Fam Zheng
@ 2014-08-27 14:40   ` Benoît Canet
  2014-08-28  4:04     ` Fam Zheng
  2014-08-27 17:40   ` Max Reitz
  1 sibling, 1 reply; 13+ messages in thread
From: Benoît Canet @ 2014-08-27 14:40 UTC (permalink / raw)
  To: Fam Zheng; +Cc: Kevin Wolf, qemu-devel, Stefan Hajnoczi

The Wednesday 27 Aug 2014 à 14:02:36 (+0800), Fam Zheng wrote :
> Not all the error paths release opts, fix it by moving it after the fail
> label.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block/qcow2.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/block/qcow2.c b/block/qcow2.c
> index f9e045f..b4c4a6e 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -535,7 +535,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
>      unsigned int len, i;
>      int ret = 0;
>      QCowHeader header;
> -    QemuOpts *opts;
> +    QemuOpts *opts = NULL;
>      Error *local_err = NULL;
>      uint64_t ext_end;
>      uint64_t l1_vm_state_index;
> @@ -932,7 +932,6 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
>          error_setg(errp, "Unsupported value '%s' for qcow2 option "
>                     "'overlap-check'. Allowed are either of the following: "
>                     "none, constant, cached, all", opt_overlap_check);
> -        qemu_opts_del(opts);
>          ret = -EINVAL;
>          goto fail;
>      }
> @@ -946,7 +945,6 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
>                                overlap_check_template & (1 << i)) << i;
>      }
>  
> -    qemu_opts_del(opts);
>  
>      if (s->use_lazy_refcounts && s->qcow_version < 3) {
>          error_setg(errp, "Lazy refcounts require a qcow2 image with at least "
> @@ -964,6 +962,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,


>      return ret;
The code is returning here in this case and the qemu_opts_del is hidden in the fail label.
Do we need to qemu_opts_del on success just before return like it was done before ?

>  
>   fail:
> +    qemu_opts_del(opts);
>      g_free(s->unknown_header_fields);
>      cleanup_unknown_header_ext(bs);
>      qcow2_free_snapshots(bs);
> -- 
> 2.1.0
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 2/4] blkverify: Fix leak of opts in blkverify_open
  2014-08-27  6:02 ` [Qemu-devel] [PATCH 2/4] blkverify: Fix leak of opts in blkverify_open Fam Zheng
@ 2014-08-27 14:41   ` Benoît Canet
  0 siblings, 0 replies; 13+ messages in thread
From: Benoît Canet @ 2014-08-27 14:41 UTC (permalink / raw)
  To: Fam Zheng; +Cc: Kevin Wolf, qemu-devel, Stefan Hajnoczi

The Wednesday 27 Aug 2014 à 14:02:34 (+0800), Fam Zheng wrote :
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block/blkverify.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/block/blkverify.c b/block/blkverify.c
> index 7c78ca4..163064c 100644
> --- a/block/blkverify.c
> +++ b/block/blkverify.c
> @@ -158,6 +158,7 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
>  
>      ret = 0;
>  fail:
> +    qemu_opts_del(opts);
>      return ret;
>  }
>  
> -- 
> 2.1.0
> 
> 
Reviewed-by: Benoît Canet <benoit.canet@nodalink.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 1/4] nfs: Fix leak of opts in nfs_file_open
  2014-08-27  6:02 ` [Qemu-devel] [PATCH 1/4] nfs: Fix leak of opts in nfs_file_open Fam Zheng
@ 2014-08-27 14:46   ` Benoît Canet
  2014-08-28  4:07     ` Fam Zheng
  0 siblings, 1 reply; 13+ messages in thread
From: Benoît Canet @ 2014-08-27 14:46 UTC (permalink / raw)
  To: Fam Zheng; +Cc: Kevin Wolf, qemu-devel, Stefan Hajnoczi

The Wednesday 27 Aug 2014 à 14:02:33 (+0800), Fam Zheng wrote :
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block/nfs.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/block/nfs.c b/block/nfs.c
> index 93d87f3..36e8057 100644
> --- a/block/nfs.c
> +++ b/block/nfs.c
> @@ -393,15 +393,18 @@ static int nfs_file_open(BlockDriverState *bs, QDict *options, int flags,
>      qemu_opts_absorb_qdict(opts, options, &local_err);
>      if (local_err) {
>          error_propagate(errp, local_err);
> -        return -EINVAL;
> +        ret = -EINVAL;

1)

Here you put the return code in ret and goto out.

> +        goto out;
>      }
>      ret = nfs_client_open(client, qemu_opt_get(opts, "filename"),
>                            (flags & BDRV_O_RDWR) ? O_RDWR : O_RDONLY,
>                            errp);
>      if (ret < 0) {
> -        return ret;
> +        goto out;

2) here you seem to want to do something later with the value of ret.

>      }
>      bs->total_sectors = ret;
> +out:
> +    qemu_opts_del(opts);

>      return 0;

Here the code simply return 0 discarding the return code you set in 1) and 2).

>  }
>  
> -- 
> 2.1.0
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 4/4] qcow2: Fix leak of opts in qcow2_open
  2014-08-27  6:02 ` [Qemu-devel] [PATCH 4/4] qcow2: Fix leak of opts in qcow2_open Fam Zheng
  2014-08-27 14:40   ` Benoît Canet
@ 2014-08-27 17:40   ` Max Reitz
  2014-08-28  4:06     ` Fam Zheng
  1 sibling, 1 reply; 13+ messages in thread
From: Max Reitz @ 2014-08-27 17:40 UTC (permalink / raw)
  To: Fam Zheng, qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi

On 27.08.2014 08:02, Fam Zheng wrote:
> Not all the error paths release opts, fix it by moving it after the fail
> label.
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>   block/qcow2.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)

This is pretty much the same patch as 'qcow2: Fix leak of QemuOpts in 
qcow2_open()' from my 'qapi/block-core: Add "new" qcow2 options' series. 
I guess it's up to the maintainer(s) which one gets pulled, I just want 
to point out that pulling one means leaving out the other.

Max

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 4/4] qcow2: Fix leak of opts in qcow2_open
  2014-08-27 14:40   ` Benoît Canet
@ 2014-08-28  4:04     ` Fam Zheng
  0 siblings, 0 replies; 13+ messages in thread
From: Fam Zheng @ 2014-08-28  4:04 UTC (permalink / raw)
  To: Benoît Canet; +Cc: Kevin Wolf, qemu-devel, Stefan Hajnoczi

On Wed, 08/27 16:40, Benoît Canet wrote:
> The Wednesday 27 Aug 2014 à 14:02:36 (+0800), Fam Zheng wrote :
> > Not all the error paths release opts, fix it by moving it after the fail
> > label.
> > 
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
> >  block/qcow2.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/block/qcow2.c b/block/qcow2.c
> > index f9e045f..b4c4a6e 100644
> > --- a/block/qcow2.c
> > +++ b/block/qcow2.c
> > @@ -535,7 +535,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
> >      unsigned int len, i;
> >      int ret = 0;
> >      QCowHeader header;
> > -    QemuOpts *opts;
> > +    QemuOpts *opts = NULL;
> >      Error *local_err = NULL;
> >      uint64_t ext_end;
> >      uint64_t l1_vm_state_index;
> > @@ -932,7 +932,6 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
> >          error_setg(errp, "Unsupported value '%s' for qcow2 option "
> >                     "'overlap-check'. Allowed are either of the following: "
> >                     "none, constant, cached, all", opt_overlap_check);
> > -        qemu_opts_del(opts);
> >          ret = -EINVAL;
> >          goto fail;
> >      }
> > @@ -946,7 +945,6 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
> >                                overlap_check_template & (1 << i)) << i;
> >      }
> >  
> > -    qemu_opts_del(opts);
> >  
> >      if (s->use_lazy_refcounts && s->qcow_version < 3) {
> >          error_setg(errp, "Lazy refcounts require a qcow2 image with at least "
> > @@ -964,6 +962,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
> 
> 
> >      return ret;
> The code is returning here in this case and the qemu_opts_del is hidden in the fail label.
> Do we need to qemu_opts_del on success just before return like it was done before ?

Yes, good catch.

Thanks,
Fam

> 
> >  
> >   fail:
> > +    qemu_opts_del(opts);
> >      g_free(s->unknown_header_fields);
> >      cleanup_unknown_header_ext(bs);
> >      qcow2_free_snapshots(bs);
> > -- 
> > 2.1.0
> > 
> > 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 4/4] qcow2: Fix leak of opts in qcow2_open
  2014-08-27 17:40   ` Max Reitz
@ 2014-08-28  4:06     ` Fam Zheng
  0 siblings, 0 replies; 13+ messages in thread
From: Fam Zheng @ 2014-08-28  4:06 UTC (permalink / raw)
  To: Max Reitz; +Cc: Kevin Wolf, qemu-devel, Stefan Hajnoczi

On Wed, 08/27 19:40, Max Reitz wrote:
> On 27.08.2014 08:02, Fam Zheng wrote:
> >Not all the error paths release opts, fix it by moving it after the fail
> >label.
> >
> >Signed-off-by: Fam Zheng <famz@redhat.com>
> >---
> >  block/qcow2.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> This is pretty much the same patch as 'qcow2: Fix leak of QemuOpts in
> qcow2_open()' from my 'qapi/block-core: Add "new" qcow2 options' series. I
> guess it's up to the maintainer(s) which one gets pulled, I just want to
> point out that pulling one means leaving out the other.

Since I need to respin this series, I will drop this one and leave it for your
series.

Thanks for pointing out. :)

Fam

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 1/4] nfs: Fix leak of opts in nfs_file_open
  2014-08-27 14:46   ` Benoît Canet
@ 2014-08-28  4:07     ` Fam Zheng
  0 siblings, 0 replies; 13+ messages in thread
From: Fam Zheng @ 2014-08-28  4:07 UTC (permalink / raw)
  To: Benoît Canet; +Cc: Kevin Wolf, qemu-devel, Stefan Hajnoczi

On Wed, 08/27 16:46, Benoît Canet wrote:
> The Wednesday 27 Aug 2014 à 14:02:33 (+0800), Fam Zheng wrote :
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
> >  block/nfs.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/block/nfs.c b/block/nfs.c
> > index 93d87f3..36e8057 100644
> > --- a/block/nfs.c
> > +++ b/block/nfs.c
> > @@ -393,15 +393,18 @@ static int nfs_file_open(BlockDriverState *bs, QDict *options, int flags,
> >      qemu_opts_absorb_qdict(opts, options, &local_err);
> >      if (local_err) {
> >          error_propagate(errp, local_err);
> > -        return -EINVAL;
> > +        ret = -EINVAL;
> 
> 1)
> 
> Here you put the return code in ret and goto out.
> 
> > +        goto out;
> >      }
> >      ret = nfs_client_open(client, qemu_opt_get(opts, "filename"),
> >                            (flags & BDRV_O_RDWR) ? O_RDWR : O_RDONLY,
> >                            errp);
> >      if (ret < 0) {
> > -        return ret;
> > +        goto out;
> 
> 2) here you seem to want to do something later with the value of ret.
> 
> >      }
> >      bs->total_sectors = ret;
> > +out:
> > +    qemu_opts_del(opts);
> 
> >      return 0;
> 
> Here the code simply return 0 discarding the return code you set in 1) and 2).

Good catch. Will fix.

Fam

> 
> >  }
> >  
> > -- 
> > 2.1.0
> > 
> > 

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-08-28  4:07 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-27  6:02 [Qemu-devel] [PATCH 0/4] block: Fix leaks of opts in block drivers Fam Zheng
2014-08-27  6:02 ` [Qemu-devel] [PATCH 1/4] nfs: Fix leak of opts in nfs_file_open Fam Zheng
2014-08-27 14:46   ` Benoît Canet
2014-08-28  4:07     ` Fam Zheng
2014-08-27  6:02 ` [Qemu-devel] [PATCH 2/4] blkverify: Fix leak of opts in blkverify_open Fam Zheng
2014-08-27 14:41   ` Benoît Canet
2014-08-27  6:02 ` [Qemu-devel] [PATCH 3/4] quorum: Fix leak of opts in quorum_open Fam Zheng
2014-08-27 14:36   ` Benoît Canet
2014-08-27  6:02 ` [Qemu-devel] [PATCH 4/4] qcow2: Fix leak of opts in qcow2_open Fam Zheng
2014-08-27 14:40   ` Benoît Canet
2014-08-28  4:04     ` Fam Zheng
2014-08-27 17:40   ` Max Reitz
2014-08-28  4:06     ` Fam Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).