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

Remember to call qemu_opts_del before function returning.

v3: Fix nfs return code again! (Benoit)

v2: Drop qcow2 fix since it's duplicated with Max's "[PATCH 0/4]
    qapi/block-core: Add "new" qcow2 options" series. (Max)
    Fix nfs return code. (Benoit)
    Add Beniot's rev-by lines in other patches. (Thanks for reviewing)


Fam Zheng (3):
  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

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

-- 
2.1.0

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

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

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

diff --git a/block/nfs.c b/block/nfs.c
index 93d87f3..194f301 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -393,16 +393,20 @@ 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;
-    return 0;
+    ret = 0;
+out:
+    qemu_opts_del(opts);
+    return ret;
 }
 
 static int nfs_file_create(const char *url, QemuOpts *opts, Error **errp)
-- 
2.1.0

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

* [Qemu-devel] [PATCH v3 2/3] blkverify: Fix leak of opts in blkverify_open
  2014-08-28  5:56 [Qemu-devel] [PATCH v3 0/3] block: Fix leaks of opts in block drivers Fam Zheng
  2014-08-28  5:56 ` [Qemu-devel] [PATCH v3 1/3] nfs: Fix leak of opts in nfs_file_open Fam Zheng
@ 2014-08-28  5:56 ` Fam Zheng
  2014-08-28  5:56 ` [Qemu-devel] [PATCH v3 3/3] quorum: Fix leak of opts in quorum_open Fam Zheng
  2014-08-29 16:10 ` [Qemu-devel] [PATCH v3 0/3] block: Fix leaks of opts in block drivers Stefan Hajnoczi
  3 siblings, 0 replies; 6+ messages in thread
From: Fam Zheng @ 2014-08-28  5:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, benoit.canet, Stefan Hajnoczi

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Benoît Canet <benoit.canet@nodalink.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] 6+ messages in thread

* [Qemu-devel] [PATCH v3 3/3] quorum: Fix leak of opts in quorum_open
  2014-08-28  5:56 [Qemu-devel] [PATCH v3 0/3] block: Fix leaks of opts in block drivers Fam Zheng
  2014-08-28  5:56 ` [Qemu-devel] [PATCH v3 1/3] nfs: Fix leak of opts in nfs_file_open Fam Zheng
  2014-08-28  5:56 ` [Qemu-devel] [PATCH v3 2/3] blkverify: Fix leak of opts in blkverify_open Fam Zheng
@ 2014-08-28  5:56 ` Fam Zheng
  2014-08-29 16:10 ` [Qemu-devel] [PATCH v3 0/3] block: Fix leaks of opts in block drivers Stefan Hajnoczi
  3 siblings, 0 replies; 6+ messages in thread
From: Fam Zheng @ 2014-08-28  5:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, benoit.canet, Stefan Hajnoczi

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Benoît Canet <benoit.canet@nodalink.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] 6+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/3] nfs: Fix leak of opts in nfs_file_open
  2014-08-28  5:56 ` [Qemu-devel] [PATCH v3 1/3] nfs: Fix leak of opts in nfs_file_open Fam Zheng
@ 2014-08-28  6:43   ` Benoît Canet
  0 siblings, 0 replies; 6+ messages in thread
From: Benoît Canet @ 2014-08-28  6:43 UTC (permalink / raw)
  To: Fam Zheng; +Cc: Kevin Wolf, benoit.canet, qemu-devel, Stefan Hajnoczi

The Thursday 28 Aug 2014 à 13:56:10 (+0800), Fam Zheng wrote :
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block/nfs.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/block/nfs.c b/block/nfs.c
> index 93d87f3..194f301 100644
> --- a/block/nfs.c
> +++ b/block/nfs.c
> @@ -393,16 +393,20 @@ 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;
> -    return 0;
> +    ret = 0;
> +out:
> +    qemu_opts_del(opts);
> +    return ret;
>  }
>  
>  static int nfs_file_create(const char *url, QemuOpts *opts, Error **errp)
> -- 
> 2.1.0
> 
> 
Reviewed-by: Benoît Canet <benoit.canet@nodalink.com>

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

* Re: [Qemu-devel] [PATCH v3 0/3] block: Fix leaks of opts in block drivers
  2014-08-28  5:56 [Qemu-devel] [PATCH v3 0/3] block: Fix leaks of opts in block drivers Fam Zheng
                   ` (2 preceding siblings ...)
  2014-08-28  5:56 ` [Qemu-devel] [PATCH v3 3/3] quorum: Fix leak of opts in quorum_open Fam Zheng
@ 2014-08-29 16:10 ` Stefan Hajnoczi
  3 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2014-08-29 16:10 UTC (permalink / raw)
  To: Fam Zheng; +Cc: Kevin Wolf, benoit.canet, qemu-devel, Stefan Hajnoczi

[-- Attachment #1: Type: text/plain, Size: 859 bytes --]

On Thu, Aug 28, 2014 at 01:56:09PM +0800, Fam Zheng wrote:
> Remember to call qemu_opts_del before function returning.
> 
> v3: Fix nfs return code again! (Benoit)
> 
> v2: Drop qcow2 fix since it's duplicated with Max's "[PATCH 0/4]
>     qapi/block-core: Add "new" qcow2 options" series. (Max)
>     Fix nfs return code. (Benoit)
>     Add Beniot's rev-by lines in other patches. (Thanks for reviewing)
> 
> 
> Fam Zheng (3):
>   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
> 
>  block/blkverify.c |  1 +
>  block/nfs.c       | 10 +++++++---
>  block/quorum.c    |  3 ++-
>  3 files changed, 10 insertions(+), 4 deletions(-)
> 
> -- 
> 2.1.0
> 
> 

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

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

end of thread, other threads:[~2014-08-29 16:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-28  5:56 [Qemu-devel] [PATCH v3 0/3] block: Fix leaks of opts in block drivers Fam Zheng
2014-08-28  5:56 ` [Qemu-devel] [PATCH v3 1/3] nfs: Fix leak of opts in nfs_file_open Fam Zheng
2014-08-28  6:43   ` Benoît Canet
2014-08-28  5:56 ` [Qemu-devel] [PATCH v3 2/3] blkverify: Fix leak of opts in blkverify_open Fam Zheng
2014-08-28  5:56 ` [Qemu-devel] [PATCH v3 3/3] quorum: Fix leak of opts in quorum_open Fam Zheng
2014-08-29 16:10 ` [Qemu-devel] [PATCH v3 0/3] block: Fix leaks of opts in block drivers Stefan Hajnoczi

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).