Print this page
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>

*** 20,29 **** --- 20,30 ---- */ /* * 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> #include <sys/types.h> #include <netinet/in.h>
*** 585,607 **** &propStringData) != -1) { if (devid_str_decode(propStringData, &devid, NULL) != -1) { guidStr = devid_to_guid(devid); if (guidStr != NULL) { (void) strlcpy(mapping_ptr->entry.LUID.buffer, ! guidStr, 256); 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. */ log(LOG_DEBUG, ROUTINE, "failed to get devid guid on (%s) : %s", devpath, strerror(errno)); } } else { /* * device may not support proper page 83 id descriptor. * leave LUID attribute to NULL and continue. */ --- 586,611 ---- &propStringData) != -1) { if (devid_str_decode(propStringData, &devid, NULL) != -1) { guidStr = devid_to_guid(devid); if (guidStr != NULL) { (void) strlcpy(mapping_ptr->entry.LUID.buffer, ! 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. */ 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. * leave LUID attribute to NULL and continue. */
*** 1003,1022 **** } else { /* * Note: * if logical unit associated page 83 id * descriptor is not avaialble for the device ! * devid_to_guid returns NULl with errno 0. */ log(LOG_DEBUG, ROUTINE, "failed to get devid guid on (%s)", " associated with path(%s) : %s", clientdevpath, pathdevpath ? pathdevpath : "(missing device path)", strerror(errno)); } } else { /* * device may not support proper page 83 id descriptor. * leave LUID attribute to NULL and continue. */ --- 1007,1028 ---- } else { /* * Note: * if logical unit associated page 83 id * descriptor is not avaialble for the device ! * devid_to_guid returns NULL with errno 0. */ log(LOG_DEBUG, ROUTINE, "failed to get devid guid on (%s)", " associated with path(%s) : %s", clientdevpath, pathdevpath ? pathdevpath : "(missing device path)", strerror(errno)); } + + devid_free(devid); } else { /* * device may not support proper page 83 id descriptor. * leave LUID attribute to NULL and continue. */