* [Qemu-devel] [PATCH v2 0/3] block: Fix leaks of opts in block drivers @ 2014-08-28 4:12 Fam Zheng 2014-08-28 4:12 ` [Qemu-devel] [PATCH v2 1/3] nfs: Fix leak of opts in nfs_file_open Fam Zheng ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Fam Zheng @ 2014-08-28 4:12 UTC (permalink / raw) To: qemu-devel; +Cc: Kevin Wolf, benoit.canet, Stefan Hajnoczi Remember to call qemu_opts_del before function returning. 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 | 8 ++++++-- block/quorum.c | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) -- 2.1.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH v2 1/3] nfs: Fix leak of opts in nfs_file_open 2014-08-28 4:12 [Qemu-devel] [PATCH v2 0/3] block: Fix leaks of opts in block drivers Fam Zheng @ 2014-08-28 4:12 ` Fam Zheng 2014-08-28 4:48 ` Benoît Canet 2014-08-28 4:12 ` [Qemu-devel] [PATCH v2 2/3] blkverify: Fix leak of opts in blkverify_open Fam Zheng 2014-08-28 4:12 ` [Qemu-devel] [PATCH v2 3/3] quorum: Fix leak of opts in quorum_open Fam Zheng 2 siblings, 1 reply; 6+ messages in thread From: Fam Zheng @ 2014-08-28 4:12 UTC (permalink / raw) To: qemu-devel; +Cc: Kevin Wolf, benoit.canet, Stefan Hajnoczi Signed-off-by: Fam Zheng <famz@redhat.com> --- block/nfs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/block/nfs.c b/block/nfs.c index 93d87f3..8740c1a 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -393,15 +393,19 @@ 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; + ret = 0; +out: + qemu_opts_del(opts); return 0; } -- 2.1.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/3] nfs: Fix leak of opts in nfs_file_open 2014-08-28 4:12 ` [Qemu-devel] [PATCH v2 1/3] nfs: Fix leak of opts in nfs_file_open Fam Zheng @ 2014-08-28 4:48 ` Benoît Canet 2014-08-28 5:49 ` Fam Zheng 0 siblings, 1 reply; 6+ messages in thread From: Benoît Canet @ 2014-08-28 4:48 UTC (permalink / raw) To: Fam Zheng; +Cc: Kevin Wolf, benoit.canet, qemu-devel, Stefan Hajnoczi The Thursday 28 Aug 2014 à 12:12:36 (+0800), Fam Zheng wrote : > Signed-off-by: Fam Zheng <famz@redhat.com> > --- > block/nfs.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/block/nfs.c b/block/nfs.c > index 93d87f3..8740c1a 100644 > --- a/block/nfs.c > +++ b/block/nfs.c > @@ -393,15 +393,19 @@ 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; > + ret = 0; > +out: > + qemu_opts_del(opts); > return 0; Hmm ... "return ret;" ? ;) > } > > -- > 2.1.0 > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/3] nfs: Fix leak of opts in nfs_file_open 2014-08-28 4:48 ` Benoît Canet @ 2014-08-28 5:49 ` Fam Zheng 0 siblings, 0 replies; 6+ messages in thread From: Fam Zheng @ 2014-08-28 5:49 UTC (permalink / raw) To: Benoît Canet; +Cc: Kevin Wolf, qemu-devel, Stefan Hajnoczi On Thu, 08/28 06:48, Benoît Canet wrote: > The Thursday 28 Aug 2014 à 12:12:36 (+0800), Fam Zheng wrote : > > Signed-off-by: Fam Zheng <famz@redhat.com> > > --- > > block/nfs.c | 8 ++++++-- > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > diff --git a/block/nfs.c b/block/nfs.c > > index 93d87f3..8740c1a 100644 > > --- a/block/nfs.c > > +++ b/block/nfs.c > > @@ -393,15 +393,19 @@ 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; > > + ret = 0; > > +out: > > + qemu_opts_del(opts); > > > return 0; > > Hmm ... "return ret;" ? ;) > Oops, patches that are not right in the first try always tend to fail again :) Fam ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH v2 2/3] blkverify: Fix leak of opts in blkverify_open 2014-08-28 4:12 [Qemu-devel] [PATCH v2 0/3] block: Fix leaks of opts in block drivers Fam Zheng 2014-08-28 4:12 ` [Qemu-devel] [PATCH v2 1/3] nfs: Fix leak of opts in nfs_file_open Fam Zheng @ 2014-08-28 4:12 ` Fam Zheng 2014-08-28 4:12 ` [Qemu-devel] [PATCH v2 3/3] quorum: Fix leak of opts in quorum_open Fam Zheng 2 siblings, 0 replies; 6+ messages in thread From: Fam Zheng @ 2014-08-28 4:12 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 v2 3/3] quorum: Fix leak of opts in quorum_open 2014-08-28 4:12 [Qemu-devel] [PATCH v2 0/3] block: Fix leaks of opts in block drivers Fam Zheng 2014-08-28 4:12 ` [Qemu-devel] [PATCH v2 1/3] nfs: Fix leak of opts in nfs_file_open Fam Zheng 2014-08-28 4:12 ` [Qemu-devel] [PATCH v2 2/3] blkverify: Fix leak of opts in blkverify_open Fam Zheng @ 2014-08-28 4:12 ` Fam Zheng 2 siblings, 0 replies; 6+ messages in thread From: Fam Zheng @ 2014-08-28 4:12 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
end of thread, other threads:[~2014-08-28 5:49 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-08-28 4:12 [Qemu-devel] [PATCH v2 0/3] block: Fix leaks of opts in block drivers Fam Zheng 2014-08-28 4:12 ` [Qemu-devel] [PATCH v2 1/3] nfs: Fix leak of opts in nfs_file_open Fam Zheng 2014-08-28 4:48 ` Benoît Canet 2014-08-28 5:49 ` Fam Zheng 2014-08-28 4:12 ` [Qemu-devel] [PATCH v2 2/3] blkverify: Fix leak of opts in blkverify_open Fam Zheng 2014-08-28 4:12 ` [Qemu-devel] [PATCH v2 3/3] quorum: Fix leak of opts in quorum_open 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).