mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 23:25:24 +00:00
Fix potential false-positive OOM error reporting.
If no matching device was found (cap == NULL) then no strdup() call was made and *wwnn and *wwpn are untouched. Checking them for NULL in this situation may result in reporting an false-positive OOM error because *wwnn and *wwpn may be initialized to NULL by the caller. Only check *wwnn and *wwpn for NULL if a matching device was found (cap != NULL) and thus strdup() was called. * src/conf/node_device_conf.c: only report an OOM error if there really is one
This commit is contained in:
parent
2f4682a9f8
commit
4ed2c3773e
@ -1243,9 +1243,7 @@ virNodeDeviceGetWWNs(virConnectPtr conn,
|
|||||||
virNodeDeviceReportError(conn, VIR_ERR_NO_SUPPORT,
|
virNodeDeviceReportError(conn, VIR_ERR_NO_SUPPORT,
|
||||||
"%s", _("Device is not a fibre channel HBA"));
|
"%s", _("Device is not a fibre channel HBA"));
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
} else if (*wwnn == NULL || *wwpn == NULL) {
|
||||||
|
|
||||||
if (*wwnn == NULL || *wwpn == NULL) {
|
|
||||||
/* Free the other one, if allocated... */
|
/* Free the other one, if allocated... */
|
||||||
VIR_FREE(wwnn);
|
VIR_FREE(wwnn);
|
||||||
VIR_FREE(wwpn);
|
VIR_FREE(wwpn);
|
||||||
|
Loading…
Reference in New Issue
Block a user