[PATCH] daemon: ldm: avoid manual free()
by Pino Toscano
When the LDM code was converted to the CLEANUP_* macros, a free()
invocation for a CLEANUP_FREE variable was left in the
ldmtool_diskgroup_volumes implementation, causing double-free on
success.
Updates commit 950951c67de61da27dceca8ffb2079031c13e43b.
---
daemon/ldm.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/daemon/ldm.c b/daemon/ldm.c
index 1bab28989..2f4d2aef3 100644
--- a/daemon/ldm.c
+++ b/daemon/ldm.c
@@ -286,7 +286,6 @@ do_ldmtool_diskgroup_volumes (const char *diskgroup)
reply_with_error ("%s", err);
return NULL;
}
- free (err);
return parse_json_get_object_string_list (out, "volumes",
__func__, "ldmtool show diskgroup");
--
2.13.6
7 years, 1 month
[PATCH] diff: avoid potential null pointer dereference on error
by Pino Toscano
If visit_guest() fails, then it returns a null pointer; later on,
free_tree() is called unconditionally on the variables, thus
dereferencing null pointers.
Thus guard the free_tree() invocations.
---
diff/diff.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/diff/diff.c b/diff/diff.c
index 5851a1c9c..1f1ab6933 100644
--- a/diff/diff.c
+++ b/diff/diff.c
@@ -389,8 +389,10 @@ main (int argc, char *argv[])
errors++;
}
- free_tree (tree1);
- free_tree (tree2);
+ if (tree1)
+ free_tree (tree1);
+ if (tree2)
+ free_tree (tree2);
free_drives (drvs);
free_drives (drvs2);
--
2.13.6
7 years, 1 month
[PATCH 0/2] (mainly for discussion) Add ‘return’ statement.
by Richard W.M. Jones
When rewriting the heavily imperative original inspection code, I
longed for a ‘return’ statement so I could keep the new code as close
as possible to the original. OCaml of course does not have such a
statement, but it's relatively simply to implement it in the language.
The first patch does so, and the second patch rewrites a sample of the
inspection code to use it.
Rich.
7 years, 1 month
[PATCH] daemon: btrfs: remove dead check
by Pino Toscano
In btrfs_subvolume_show, an extra check on 'key' is used in a place
where this variable is already checked to be non-null.
---
daemon/btrfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index f11902b21..d363ada6d 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -990,7 +990,7 @@ do_btrfs_subvolume_show (const char *subvolume)
return NULL;
}
} else {
- if (add_string (&ret, key ? key : "") == -1)
+ if (add_string (&ret, key) == -1)
return NULL;
if (value && !STREQ (value, "-")) {
if (add_string (&ret, value) == -1)
--
2.13.6
7 years, 1 month
[PATCH] daemon: btrfs: fix bad handling of a couple of errors
by Pino Toscano
Remove two wrong error handling situations in btrfs_balance_status:
- if the calloc for 'ret' fails, the 'goto error' would try to
dereference the resulting null pointer (to free the items of the
return struct); hence, just return null directly, instead of jumping
to 'error'
- if the strdup() for 'btrfsbalance_status' fails, then the directly
return would leak 'ret'
---
daemon/btrfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index d363ada6d..26757d4fb 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1686,7 +1686,7 @@ do_btrfs_balance_status (const char *path)
ret = calloc (1, sizeof *ret);
if (ret == NULL) {
reply_with_perror ("calloc");
- goto error;
+ return NULL;
}
/* Output of `btrfs balance status' is like:
@@ -1715,7 +1715,7 @@ do_btrfs_balance_status (const char *path)
ret->btrfsbalance_status = strdup ("none");
if (ret->btrfsbalance_status == NULL) {
reply_with_perror ("strdup");
- return NULL;
+ goto error;
}
return ret;
}
--
2.13.6
7 years, 1 month
Libguestfs for RHEL 7.5 preview repository
by Richard W.M. Jones
As in previous years, I'm making an unofficial, unsupported, unsigned
yum repository containing a preview of the libguestfs and virt-v2v
RHEL 7.5 packages:
https://people.redhat.com/~rjones/libguestfs-RHEL-7.5-preview/
PLEASE DO NOT CONTACT RED HAT SUPPORT ABOUT THESE PACKAGES. If you
find any problems, contact the upstream mailing list directly by
emailing <libguestfs(a)redhat.com>
You will also find previews of augeas, hivex, OCaml 4.05, supermin,
virt-top and virt-what. It should be possible to rebuild all of the
packages from the corresponding source RPMs, but if I've missed out
any dependency then let me know.
** To install **
(1) Create a file called /etc/yum.repos.d/libguestfs-RHEL-7.5-preview.repo
with the following content:
[libguestfs-RHEL-7.5-preview]
name=libguestfs RHEL 7.5 preview
baseurl=https://people.redhat.com/~rjones/libguestfs-RHEL-7.5-preview/
enabled=1
gpgcheck=0
(2) Install or upgrade libguestfs, virt-v2v etc:
# yum install libguestfs libguestfs-tools-c virt-v2v
** To go back to the supported packages **
(1) Uninstall libguestfs:
# yum remove libguestfs
(2) Delete /etc/yum.repos.d/libguestfs-RHEL-7.5-preview.repo
# rm /etc/yum.repos.d/libguestfs-RHEL-7.5-preview.repo
(3) Reinstall libguestfs from the ordinary RHN channels:
# yum install libguestfs libguestfs-tools-c virt-v2v
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
7 years, 1 month
[PATCH] v2v: -i ova: parse MAC address from <rasd:Address> (RHBZ#1506572)
by Pino Toscano
Read the MAC address of the network interfaces from the <rasd:Address>
tag of the OVF. This seems to be one of the possible ways used in OVFs.
---
v2v/parse_ovf_from_ova.ml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/v2v/parse_ovf_from_ova.ml b/v2v/parse_ovf_from_ova.ml
index fe8228dcc..4ee6bc901 100644
--- a/v2v/parse_ovf_from_ova.ml
+++ b/v2v/parse_ovf_from_ova.ml
@@ -232,8 +232,9 @@ let parse_ovf_from_ova ovf_filename =
let vnet =
Option.default (sprintf"eth%d" i)
(xpath_string "rasd:ElementName/text()") in
+ let mac = xpath_string "rasd:Address/text()" in
let nic = {
- s_mac = None;
+ s_mac = mac;
s_nic_model = None;
s_vnet = vnet;
s_vnet_orig = vnet;
--
2.13.6
7 years, 1 month