diff options
author | Benjamin Marzinski <bmarzins@redhat.com> | 2012-06-05 18:04:36 -0500 |
---|---|---|
committer | Christophe Varoqui <christophe.varoqui@opensvc.com> | 2012-06-06 20:09:01 +0200 |
commit | a00088a0162fe96d647c42902a9f86c4950b907f (patch) | |
tree | 98d16c72c9c30baf93113111e84da129956a3eac /libmultipath/discovery.c | |
parent | ac25859c3e58bae0471f6c28bd1af67d49d78406 (diff) | |
download | multipath-tools-a00088a0162fe96d647c42902a9f86c4950b907f.tar.gz multipath-tools-a00088a0162fe96d647c42902a9f86c4950b907f.tar.bz2 multipath-tools-a00088a0162fe96d647c42902a9f86c4950b907f.zip |
multipath: libudev cleanup and bugfixes
get_refwwid wasn't working anymore, since it wasn't setting the path's udevice.
Also, cli_add_path was dereferencing a NULL pointer (pp). Finally, there were
a number of places where udev devices weren't getting dereferenced when they
should have been, causing memory leaks. This patch cleans these up.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Diffstat (limited to 'libmultipath/discovery.c')
-rw-r--r-- | libmultipath/discovery.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index c408721..25c7cda 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -216,11 +216,11 @@ sysfs_get_tgt_nodename (struct path *pp, char * node) const char *value; value = udev_device_get_sysattr_value(tgtdev, "node_name"); + udev_device_unref(tgtdev); if (value) { strncpy(node, value, NODE_NAME_SIZE); return 0; } - udev_device_unref(tgtdev); } /* Check for iSCSI */ @@ -235,15 +235,15 @@ sysfs_get_tgt_nodename (struct path *pp, char * node) } if (parent) { tgtdev = udev_device_new_from_subsystem_sysname(conf->udev, "iscsi_session", targetid); - if (node) { + if (tgtdev) { const char *value; value = udev_device_get_sysattr_value(tgtdev, "targetname"); + udev_device_unref(tgtdev); if (value) { strncpy(node, value, NODE_NAME_SIZE); return 0; } - udev_device_unref(tgtdev); } } return 1; @@ -289,7 +289,7 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp) value, 11) < 0) condlog(0, "%s failed to set dev_loss_tmo", mpp->alias); - return; + goto out; } } if (mpp->fast_io_fail){ @@ -305,6 +305,8 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp) mpp->alias); } } +out: + udev_device_unref(rport_dev); } int |