* [Qemu-devel] [PULL 00/17] Block patches
@ 2014-06-02 13:56 Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 01/17] qemu-img: Plug memory leak on block option help error path Kevin Wolf
` (17 more replies)
0 siblings, 18 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
The following changes since commit d7d3d6092cb7edc75dc49fb90c86dd5425ab4805:
Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging (2014-05-28 18:38:39 +0100)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to 55d492d7602c27cabb605f42e72c755de1c186c1:
qemu-img: Report error even with --oformat=json (2014-06-02 13:58:40 +0200)
----------------------------------------------------------------
Block patches
----------------------------------------------------------------
Fam Zheng (1):
vmdk: Fix local_err in vmdk_create
Markus Armbruster (14):
qemu-img: Plug memory leak on block option help error path
block/vvfat: Plug memory leak in enable_write_target()
qcow2: Plug memory leak on qcow2_invalidate_cache() error paths
block: Plug memory leak on brv_open_image() error path
qemu-io: Support multiple -o in open command
qemu-io: Plug memory leak in open command
qemu-io: Don't print NULL when open without non-option arg fails
blockdev: Plug memory leak in blockdev_init()
blockdev: Plug memory leak in drive_init()
block/qapi: Plug memory leak in dump_qobject() case QTYPE_QERROR
block/vvfat: Plug memory leak in check_directory_consistency()
block/vvfat: Plug memory leak in read_directory()
block/sheepdog: Plug memory leak in sd_snapshot_create()
qemu-img: Plug memory leak in convert command
Max Reitz (1):
qemu-img: Report error even with --oformat=json
Peter Maydell (1):
block/raw-posix.c: Avoid nonstandard LONG_LONG_MAX
block.c | 1 +
block/qapi.c | 1 +
block/qcow2.c | 3 +--
block/raw-posix.c | 2 +-
block/sheepdog.c | 4 ++--
block/vmdk.c | 8 ++++----
block/vvfat.c | 7 +++++--
blockdev.c | 7 +++++--
qemu-img.c | 7 +++----
qemu-io.c | 22 +++++++++++++++-------
10 files changed, 38 insertions(+), 24 deletions(-)
^ permalink raw reply [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 01/17] qemu-img: Plug memory leak on block option help error path
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
@ 2014-06-02 13:56 ` Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 02/17] block/vvfat: Plug memory leak in enable_write_target() Kevin Wolf
` (16 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
Introduced in commit a283cb6; mostly harmless. Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
qemu-img.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/qemu-img.c b/qemu-img.c
index 1ad899e..62ea27e 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -287,6 +287,7 @@ static int print_block_option_help(const char *filename, const char *fmt)
proto_drv = bdrv_find_protocol(filename, true);
if (!proto_drv) {
error_report("Unknown protocol '%s'", filename);
+ free_option_parameters(create_options);
return 1;
}
create_options = append_option_parameters(create_options,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 02/17] block/vvfat: Plug memory leak in enable_write_target()
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 01/17] qemu-img: Plug memory leak on block option help error path Kevin Wolf
@ 2014-06-02 13:56 ` Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 03/17] qcow2: Plug memory leak on qcow2_invalidate_cache() error paths Kevin Wolf
` (15 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
I figure the leak originated in bdrv_create2(), and was duplicated
into callers when commit 91a073a dropped that function. Looks like
the other places have since been fixed.
Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/vvfat.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/vvfat.c b/block/vvfat.c
index 8f5114b..811b39c 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -2929,6 +2929,7 @@ static int enable_write_target(BDRVVVFATState *s, Error **errp)
set_option_parameter(options, BLOCK_OPT_BACKING_FILE, "fat:");
ret = bdrv_create(bdrv_qcow, s->qcow_filename, options, errp);
+ free_option_parameters(options);
if (ret < 0) {
goto err;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 03/17] qcow2: Plug memory leak on qcow2_invalidate_cache() error paths
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 01/17] qemu-img: Plug memory leak on block option help error path Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 02/17] block/vvfat: Plug memory leak in enable_write_target() Kevin Wolf
@ 2014-06-02 13:56 ` Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 04/17] block: Plug memory leak on brv_open_image() error path Kevin Wolf
` (14 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
Introduced in commit 5a8a30d. Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/qcow2.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index a4b97e8..a54d2ba 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1308,6 +1308,7 @@ static void qcow2_invalidate_cache(BlockDriverState *bs, Error **errp)
options = qdict_clone_shallow(bs->options);
ret = qcow2_open(bs, options, flags, &local_err);
+ QDECREF(options);
if (local_err) {
error_setg(errp, "Could not reopen qcow2 layer: %s",
error_get_pretty(local_err));
@@ -1318,8 +1319,6 @@ static void qcow2_invalidate_cache(BlockDriverState *bs, Error **errp)
return;
}
- QDECREF(options);
-
if (crypt_method) {
s->crypt_method = crypt_method;
memcpy(&s->aes_encrypt_key, &aes_encrypt_key, sizeof(aes_encrypt_key));
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 04/17] block: Plug memory leak on brv_open_image() error path
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
` (2 preceding siblings ...)
2014-06-02 13:56 ` [Qemu-devel] [PULL 03/17] qcow2: Plug memory leak on qcow2_invalidate_cache() error paths Kevin Wolf
@ 2014-06-02 13:56 ` Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 05/17] qemu-io: Support multiple -o in open command Kevin Wolf
` (13 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
Introduced in commit da557a. Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block.c b/block.c
index a517d72..310ea89 100644
--- a/block.c
+++ b/block.c
@@ -1228,6 +1228,7 @@ int bdrv_open_image(BlockDriverState **pbs, const char *filename,
bdref_key);
ret = -EINVAL;
}
+ QDECREF(image_options);
goto done;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 05/17] qemu-io: Support multiple -o in open command
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
` (3 preceding siblings ...)
2014-06-02 13:56 ` [Qemu-devel] [PULL 04/17] block: Plug memory leak on brv_open_image() error path Kevin Wolf
@ 2014-06-02 13:56 ` Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 06/17] qemu-io: Plug memory leak " Kevin Wolf
` (12 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
Instead of ignoring all option values but the last one, multiple -o
options now have the same meaning as having a single option with all
settings in the order of their respective -o options.
Same as commit 2dc8328 for qemu-img convert, except here we do it with
QemuOpts rather than QEMUOptionParameter.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
qemu-io.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/qemu-io.c b/qemu-io.c
index 9fcd72b..ef3fef6 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -118,6 +118,7 @@ static const cmdinfo_t open_cmd = {
static QemuOptsList empty_opts = {
.name = "drive",
+ .merge_lists = true,
.head = QTAILQ_HEAD_INITIALIZER(empty_opts.head),
.desc = {
/* no elements => accept any params */
@@ -132,7 +133,7 @@ static int open_f(BlockDriverState *bs, int argc, char **argv)
int growable = 0;
int c;
QemuOpts *qopts;
- QDict *opts = NULL;
+ QDict *opts;
while ((c = getopt(argc, argv, "snrgo:")) != EOF) {
switch (c) {
@@ -149,15 +150,14 @@ static int open_f(BlockDriverState *bs, int argc, char **argv)
growable = 1;
break;
case 'o':
- qopts = qemu_opts_parse(&empty_opts, optarg, 0);
- if (qopts == NULL) {
+ if (!qemu_opts_parse(&empty_opts, optarg, 0)) {
printf("could not parse option list -- %s\n", optarg);
+ qemu_opts_reset(&empty_opts);
return 0;
}
- opts = qemu_opts_to_qdict(qopts, opts);
- qemu_opts_del(qopts);
break;
default:
+ qemu_opts_reset(&empty_opts);
return qemuio_command_usage(&open_cmd);
}
}
@@ -166,6 +166,10 @@ static int open_f(BlockDriverState *bs, int argc, char **argv)
flags |= BDRV_O_RDWR;
}
+ qopts = qemu_opts_find(&empty_opts, NULL);
+ opts = qopts ? qemu_opts_to_qdict(qopts, NULL) : NULL;
+ qemu_opts_reset(&empty_opts);
+
if (optind == argc - 1) {
return openfile(argv[optind], flags, growable, opts);
} else if (optind == argc) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 06/17] qemu-io: Plug memory leak in open command
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
` (4 preceding siblings ...)
2014-06-02 13:56 ` [Qemu-devel] [PULL 05/17] qemu-io: Support multiple -o in open command Kevin Wolf
@ 2014-06-02 13:56 ` Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 07/17] qemu-io: Don't print NULL when open without non-option arg fails Kevin Wolf
` (11 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
Introduced in commit b543c5c. Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
qemu-io.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/qemu-io.c b/qemu-io.c
index ef3fef6..f63e771 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -54,6 +54,7 @@ static int openfile(char *name, int flags, int growable, QDict *opts)
if (qemuio_bs) {
fprintf(stderr, "file open already, try 'help close'\n");
+ QDECREF(opts);
return 1;
}
@@ -175,6 +176,7 @@ static int open_f(BlockDriverState *bs, int argc, char **argv)
} else if (optind == argc) {
return openfile(NULL, flags, growable, opts);
} else {
+ QDECREF(opts);
return qemuio_command_usage(&open_cmd);
}
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 07/17] qemu-io: Don't print NULL when open without non-option arg fails
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
` (5 preceding siblings ...)
2014-06-02 13:56 ` [Qemu-devel] [PULL 06/17] qemu-io: Plug memory leak " Kevin Wolf
@ 2014-06-02 13:56 ` Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 08/17] blockdev: Plug memory leak in blockdev_init() Kevin Wolf
` (10 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
Reproducer: "open -o a=b". Broken in commit fd0fee3.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
qemu-io.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/qemu-io.c b/qemu-io.c
index f63e771..795cf46 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -62,7 +62,8 @@ static int openfile(char *name, int flags, int growable, QDict *opts)
if (bdrv_open(&qemuio_bs, name, NULL, opts, flags | BDRV_O_PROTOCOL,
NULL, &local_err))
{
- fprintf(stderr, "%s: can't open device %s: %s\n", progname, name,
+ fprintf(stderr, "%s: can't open%s%s: %s\n", progname,
+ name ? " device " : "", name ?: "",
error_get_pretty(local_err));
error_free(local_err);
return 1;
@@ -73,7 +74,8 @@ static int openfile(char *name, int flags, int growable, QDict *opts)
if (bdrv_open(&qemuio_bs, name, NULL, opts, flags, NULL, &local_err)
< 0)
{
- fprintf(stderr, "%s: can't open device %s: %s\n", progname, name,
+ fprintf(stderr, "%s: can't open%s%s: %s\n", progname,
+ name ? " device " : "", name ?: "",
error_get_pretty(local_err));
error_free(local_err);
bdrv_unref(qemuio_bs);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 08/17] blockdev: Plug memory leak in blockdev_init()
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
` (6 preceding siblings ...)
2014-06-02 13:56 ` [Qemu-devel] [PULL 07/17] qemu-io: Don't print NULL when open without non-option arg fails Kevin Wolf
@ 2014-06-02 13:56 ` Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 09/17] blockdev: Plug memory leak in drive_init() Kevin Wolf
` (9 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
blockdev_init() leaks bs_opts when qemu_opts_create() fails, i.e. when
the ID is bad. Missed in commit ec9c10d.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
blockdev.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 8cc42fb..652a052 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -351,7 +351,7 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts,
opts = qemu_opts_create(&qemu_common_drive_opts, id, 1, &error);
if (error) {
error_propagate(errp, error);
- return NULL;
+ goto err_no_opts;
}
qemu_opts_absorb_qdict(opts, bs_opts, &error);
@@ -564,8 +564,9 @@ bdrv_new_err:
g_free(dinfo->id);
g_free(dinfo);
early_err:
- QDECREF(bs_opts);
qemu_opts_del(opts);
+err_no_opts:
+ QDECREF(bs_opts);
return NULL;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 09/17] blockdev: Plug memory leak in drive_init()
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
` (7 preceding siblings ...)
2014-06-02 13:56 ` [Qemu-devel] [PULL 08/17] blockdev: Plug memory leak in blockdev_init() Kevin Wolf
@ 2014-06-02 13:56 ` Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 10/17] block/qapi: Plug memory leak in dump_qobject() case QTYPE_QERROR Kevin Wolf
` (8 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
bs_opts is leaked on all paths from its qdev_new() that don't got
through blockdev_init(). Add the missing QDECREF(), and zap bs_opts
after blockdev_init(), so the new QDECREF() does nothing when we go
through blockdev_init().
Leak introduced in commit f298d07. Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
blockdev.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/blockdev.c b/blockdev.c
index 652a052..9b5261b 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -940,6 +940,7 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
/* Actual block device init: Functionality shared with blockdev-add */
dinfo = blockdev_init(filename, bs_opts, &local_err);
+ bs_opts = NULL;
if (dinfo == NULL) {
if (local_err) {
error_report("%s", error_get_pretty(local_err));
@@ -977,6 +978,7 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
fail:
qemu_opts_del(legacy_opts);
+ QDECREF(bs_opts);
return dinfo;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 10/17] block/qapi: Plug memory leak in dump_qobject() case QTYPE_QERROR
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
` (8 preceding siblings ...)
2014-06-02 13:56 ` [Qemu-devel] [PULL 09/17] blockdev: Plug memory leak in drive_init() Kevin Wolf
@ 2014-06-02 13:56 ` Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 11/17] block/vvfat: Plug memory leak in check_directory_consistency() Kevin Wolf
` (7 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
Introduced in commit a8d8ecb. Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/qapi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/qapi.c b/block/qapi.c
index 75f44f1..97e1641 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -475,6 +475,7 @@ static void dump_qobject(fprintf_function func_fprintf, void *f,
case QTYPE_QERROR: {
QString *value = qerror_human((QError *)obj);
func_fprintf(f, "%s", qstring_get_str(value));
+ QDECREF(value);
break;
}
case QTYPE_NONE:
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 11/17] block/vvfat: Plug memory leak in check_directory_consistency()
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
` (9 preceding siblings ...)
2014-06-02 13:56 ` [Qemu-devel] [PULL 10/17] block/qapi: Plug memory leak in dump_qobject() case QTYPE_QERROR Kevin Wolf
@ 2014-06-02 13:56 ` Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 12/17] block/vvfat: Plug memory leak in read_directory() Kevin Wolf
` (6 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
On error path. Introduced in commit a046433a. Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/vvfat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/vvfat.c b/block/vvfat.c
index 811b39c..56370c5 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -1866,7 +1866,7 @@ static int check_directory_consistency(BDRVVVFATState *s,
if (s->used_clusters[cluster_num] & USED_ANY) {
fprintf(stderr, "cluster %d used more than once\n", (int)cluster_num);
- return 0;
+ goto fail;
}
s->used_clusters[cluster_num] = USED_DIRECTORY;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 12/17] block/vvfat: Plug memory leak in read_directory()
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
` (10 preceding siblings ...)
2014-06-02 13:56 ` [Qemu-devel] [PULL 11/17] block/vvfat: Plug memory leak in check_directory_consistency() Kevin Wolf
@ 2014-06-02 13:56 ` Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 13/17] block/sheepdog: Plug memory leak in sd_snapshot_create() Kevin Wolf
` (5 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
Has always been leaky. Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/vvfat.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/block/vvfat.c b/block/vvfat.c
index 56370c5..3cda19f 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -787,7 +787,9 @@ static int read_directory(BDRVVVFATState* s, int mapping_index)
s->current_mapping->path=buffer;
s->current_mapping->read_only =
(st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)) == 0;
- }
+ } else {
+ g_free(buffer);
+ }
}
closedir(dir);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 13/17] block/sheepdog: Plug memory leak in sd_snapshot_create()
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
` (11 preceding siblings ...)
2014-06-02 13:56 ` [Qemu-devel] [PULL 12/17] block/vvfat: Plug memory leak in read_directory() Kevin Wolf
@ 2014-06-02 13:56 ` Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 14/17] qemu-img: Plug memory leak in convert command Kevin Wolf
` (4 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
Has always been leaky. Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/sheepdog.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 39f7461..4ecbf5f 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -2176,6 +2176,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
strncpy(s->inode.tag, sn_info->name, sizeof(s->inode.tag));
/* we don't need to update entire object */
datalen = SD_INODE_SIZE - sizeof(s->inode.data_vdi_id);
+ inode = g_malloc(datalen);
/* refresh inode. */
fd = connect_to_sdog(s, &local_err);
@@ -2202,8 +2203,6 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
goto cleanup;
}
- inode = (SheepdogInode *)g_malloc(datalen);
-
ret = read_object(fd, (char *)inode, vid_to_vdi_oid(new_vid),
s->inode.nr_copies, datalen, 0, s->cache_flags);
@@ -2217,6 +2216,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
s->inode.name, s->inode.snap_id, s->inode.vdi_id);
cleanup:
+ g_free(inode);
closesocket(fd);
return ret;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 14/17] qemu-img: Plug memory leak in convert command
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
` (12 preceding siblings ...)
2014-06-02 13:56 ` [Qemu-devel] [PULL 13/17] block/sheepdog: Plug memory leak in sd_snapshot_create() Kevin Wolf
@ 2014-06-02 13:56 ` Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 15/17] block/raw-posix.c: Avoid nonstandard LONG_LONG_MAX Kevin Wolf
` (3 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
Introduced in commit 661a0f7. Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
qemu-img.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/qemu-img.c b/qemu-img.c
index 62ea27e..d118da5 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1455,7 +1455,7 @@ static int img_convert(int argc, char **argv)
ret = bdrv_parse_cache_flags(cache, &flags);
if (ret < 0) {
error_report("Invalid cache option: %s", cache);
- return -1;
+ goto out;
}
out_bs = bdrv_new_open("target", out_filename, out_fmt, flags, true, quiet);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 15/17] block/raw-posix.c: Avoid nonstandard LONG_LONG_MAX
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
` (13 preceding siblings ...)
2014-06-02 13:56 ` [Qemu-devel] [PULL 14/17] qemu-img: Plug memory leak in convert command Kevin Wolf
@ 2014-06-02 13:56 ` Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 16/17] vmdk: Fix local_err in vmdk_create Kevin Wolf
` (2 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Peter Maydell <peter.maydell@linaro.org>
In the MacOSX specific code in raw-posix.c we use the define
LONG_LONG_MAX. This is actually a non-standard pre-C99 define;
switch to using the standard LLONG_MAX instead.
This apparently fixes a compilation failure with certain
compiler/OS versions (though it is unclear which).
Reported-by: Peter Bartoli <peter@bartoli.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/raw-posix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 6586a0c..b7f0f26 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1192,7 +1192,7 @@ again:
if (size == 0)
#endif
#if defined(__APPLE__) && defined(__MACH__)
- size = LONG_LONG_MAX;
+ size = LLONG_MAX;
#else
size = lseek(fd, 0LL, SEEK_END);
#endif
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 16/17] vmdk: Fix local_err in vmdk_create
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
` (14 preceding siblings ...)
2014-06-02 13:56 ` [Qemu-devel] [PULL 15/17] block/raw-posix.c: Avoid nonstandard LONG_LONG_MAX Kevin Wolf
@ 2014-06-02 13:56 ` Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 17/17] qemu-img: Report error even with --oformat=json Kevin Wolf
2014-06-02 14:46 ` [Qemu-devel] [PULL 00/17] Block patches Peter Maydell
17 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Fam Zheng <famz@redhat.com>
In vmdk_create and vmdk_create_extent, initialize local_err before using
it, and don't leak it on error.
Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/vmdk.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index 480ea37..2b38f61 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1534,7 +1534,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
int ret, i;
BlockDriverState *bs = NULL;
VMDK4Header header;
- Error *local_err;
+ Error *local_err = NULL;
uint32_t tmp, magic, grains, gd_sectors, gt_size, gt_count;
uint32_t *gd_buf = NULL;
int gd_buf_size;
@@ -1700,7 +1700,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options,
{
int idx = 0;
BlockDriverState *new_bs = NULL;
- Error *local_err;
+ Error *local_err = NULL;
char *desc = NULL;
int64_t total_size = 0, filesize;
const char *adapter_type = NULL;
@@ -1881,7 +1881,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options,
} else {
ret = bdrv_create_file(filename, options, &local_err);
if (ret < 0) {
- error_setg_errno(errp, -ret, "Could not create image file");
+ error_propagate(errp, local_err);
goto exit;
}
}
@@ -1889,7 +1889,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options,
ret = bdrv_open(&new_bs, filename, NULL, NULL,
BDRV_O_RDWR | BDRV_O_PROTOCOL, NULL, &local_err);
if (ret < 0) {
- error_setg_errno(errp, -ret, "Could not write description");
+ error_propagate(errp, local_err);
goto exit;
}
ret = bdrv_pwrite(new_bs, desc_offset, desc, desc_len);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 17/17] qemu-img: Report error even with --oformat=json
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
` (15 preceding siblings ...)
2014-06-02 13:56 ` [Qemu-devel] [PULL 16/17] vmdk: Fix local_err in vmdk_create Kevin Wolf
@ 2014-06-02 13:56 ` Kevin Wolf
2014-06-02 14:46 ` [Qemu-devel] [PULL 00/17] Block patches Peter Maydell
17 siblings, 0 replies; 19+ messages in thread
From: Kevin Wolf @ 2014-06-02 13:56 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Max Reitz <mreitz@redhat.com>
img_check() should report that the format of the given image does not
support checks even if JSON output is desired. JSON data is output to
stdout, as opposed to error messages, which are (in the case of
qemu-img) printed to stderr. Therefore, it is easy to distinguish
between the two.
Also, img_info() does already use error_report() for human-readable
messages even though JSON output is desired (through
collect_image_info_list()).
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
qemu-img.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index d118da5..b3d2bc6 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -663,9 +663,7 @@ static int img_check(int argc, char **argv)
ret = collect_image_check(bs, check, filename, fmt, fix);
if (ret == -ENOTSUP) {
- if (output_format == OFORMAT_HUMAN) {
- error_report("This image format does not support checks");
- }
+ error_report("This image format does not support checks");
ret = 63;
goto fail;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [Qemu-devel] [PULL 00/17] Block patches
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
` (16 preceding siblings ...)
2014-06-02 13:56 ` [Qemu-devel] [PULL 17/17] qemu-img: Report error even with --oformat=json Kevin Wolf
@ 2014-06-02 14:46 ` Peter Maydell
17 siblings, 0 replies; 19+ messages in thread
From: Peter Maydell @ 2014-06-02 14:46 UTC (permalink / raw)
To: Kevin Wolf; +Cc: QEMU Developers
On 2 June 2014 14:56, Kevin Wolf <kwolf@redhat.com> wrote:
> The following changes since commit d7d3d6092cb7edc75dc49fb90c86dd5425ab4805:
>
> Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging (2014-05-28 18:38:39 +0100)
>
> are available in the git repository at:
>
>
> git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to 55d492d7602c27cabb605f42e72c755de1c186c1:
>
> qemu-img: Report error even with --oformat=json (2014-06-02 13:58:40 +0200)
>
> ----------------------------------------------------------------
> Block patches
>
> ----------------------------------------------------------------
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2014-06-02 14:47 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-02 13:56 [Qemu-devel] [PULL 00/17] Block patches Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 01/17] qemu-img: Plug memory leak on block option help error path Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 02/17] block/vvfat: Plug memory leak in enable_write_target() Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 03/17] qcow2: Plug memory leak on qcow2_invalidate_cache() error paths Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 04/17] block: Plug memory leak on brv_open_image() error path Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 05/17] qemu-io: Support multiple -o in open command Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 06/17] qemu-io: Plug memory leak " Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 07/17] qemu-io: Don't print NULL when open without non-option arg fails Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 08/17] blockdev: Plug memory leak in blockdev_init() Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 09/17] blockdev: Plug memory leak in drive_init() Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 10/17] block/qapi: Plug memory leak in dump_qobject() case QTYPE_QERROR Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 11/17] block/vvfat: Plug memory leak in check_directory_consistency() Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 12/17] block/vvfat: Plug memory leak in read_directory() Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 13/17] block/sheepdog: Plug memory leak in sd_snapshot_create() Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 14/17] qemu-img: Plug memory leak in convert command Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 15/17] block/raw-posix.c: Avoid nonstandard LONG_LONG_MAX Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 16/17] vmdk: Fix local_err in vmdk_create Kevin Wolf
2014-06-02 13:56 ` [Qemu-devel] [PULL 17/17] qemu-img: Report error even with --oformat=json Kevin Wolf
2014-06-02 14:46 ` [Qemu-devel] [PULL 00/17] Block patches Peter Maydell
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).