summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosef 'Jeff' Sipek <josef.sipek@nexenta.com>2015-01-22 09:47:10 -0500
committerDan McDonald <danmcd@omniti.com>2015-01-23 22:24:44 -0500
commitb045990893825c31e176b319ae8cc4ef32115d17 (patch)
tree9cd5f4247d80e7c7cdcb3b3ae2fd70dd4d9b2af3
parentf7184619589931c4b827180c213074c470f08a8f (diff)
downloadillumos-joyent-b045990893825c31e176b319ae8cc4ef32115d17.tar.gz
5552 libsun_sas leaks devids
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com> Reviewed by: Jean McCormack <jean.mccormack@nexenta.com> Reviewed by: Marcel Telka <marcel.telka@nexenta.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Approved by: Dan McDonald <danmcd@omniti.com>
-rw-r--r--usr/src/lib/sun_sas/common/devtree_device_disco.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr/src/lib/sun_sas/common/devtree_device_disco.c b/usr/src/lib/sun_sas/common/devtree_device_disco.c
index 3e8ad260b9..90fb546051 100644
--- a/usr/src/lib/sun_sas/common/devtree_device_disco.c
+++ b/usr/src/lib/sun_sas/common/devtree_device_disco.c
@@ -22,6 +22,7 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
*/
#include <sun_sas.h>
@@ -587,19 +588,22 @@ get_attached_devices_info(di_node_t node, struct sun_sas_port *port_ptr)
guidStr = devid_to_guid(devid);
if (guidStr != NULL) {
(void) strlcpy(mapping_ptr->entry.LUID.buffer,
- guidStr, 256);
+ guidStr,
+ sizeof (mapping_ptr->entry.LUID.buffer));
devid_free_guid(guidStr);
} else {
/*
* Note:
* if logical unit associated page 83 id
* descriptor is not avaialble for the device
- * devid_to_guid returns NULl with errno 0.
+ * devid_to_guid returns NULL with errno 0.
*/
log(LOG_DEBUG, ROUTINE,
"failed to get devid guid on (%s) : %s",
devpath, strerror(errno));
}
+
+ devid_free(devid);
} else {
/*
* device may not support proper page 83 id descriptor.
@@ -1005,7 +1009,7 @@ get_attached_paths_info(di_path_t path, struct sun_sas_port *port_ptr)
* Note:
* if logical unit associated page 83 id
* descriptor is not avaialble for the device
- * devid_to_guid returns NULl with errno 0.
+ * devid_to_guid returns NULL with errno 0.
*/
log(LOG_DEBUG, ROUTINE,
"failed to get devid guid on (%s)",
@@ -1015,6 +1019,8 @@ get_attached_paths_info(di_path_t path, struct sun_sas_port *port_ptr)
"(missing device path)",
strerror(errno));
}
+
+ devid_free(devid);
} else {
/*
* device may not support proper page 83 id descriptor.