DragonFlyBSD Kernel Audit
DF-1014 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/bus/cam/scsi/scsi_ses.c b/sys/bus/cam/scsi/scsi_ses.c
--- a/sys/bus/cam/scsi/scsi_ses.c
+++ b/sys/bus/cam/scsi/scsi_ses.c
@@ -238,6 +238,15 @@
 	cam_extend_release(sesperiphs, periph->unit_number);
 	xpt_print(periph->path, "removing device entry\n");
 	dev_ops_remove_minor(&ses_ops, periph->unit_number);
+	/* DF-1014: free dynamically-allocated SES members */
+	if (softc->ses_objmap != NULL) {
+		kfree(softc->ses_objmap, M_SCSISES);
+		softc->ses_objmap = NULL;
+	}
+	if (softc->ses_private != NULL) {
+		kfree(softc->ses_private, M_SCSISES);
+		softc->ses_private = NULL;
+	}
 	kfree(softc, M_SCSISES);
 }