Merge pull request #147 from plieven/destroy_segfault2

init: fix segfault in iscsi_destroy_context
This commit is contained in:
Ronnie Sahlberg
2015-03-19 06:18:43 -07:00

View File

@@ -295,7 +295,7 @@ iscsi_destroy_context(struct iscsi_context *iscsi)
/* If an error happened during connect/login, we don't want to
call any of the callbacks.
*/
if (iscsi->is_loggedin) {
if (iscsi->is_loggedin && pdu->callback != NULL) {
pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
pdu->private_data);
}
@@ -307,7 +307,7 @@ iscsi_destroy_context(struct iscsi_context *iscsi)
/* If an error happened during connect/login, we don't want to
call any of the callbacks.
*/
if (iscsi->is_loggedin) {
if (iscsi->is_loggedin && pdu->callback != NULL) {
pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
pdu->private_data);
}