status_t HIDReport::SendReport() { size_t reportSize = ReportSize(); uint8 *report = (uint8 *)malloc(reportSize); if (report == NULL) return B_NO_MEMORY; fCurrentReport = report; memset(fCurrentReport, 0, reportSize); for (uint32 i = 0; i < fItemsUsed; i++) { HIDReportItem *item = fItems[i]; if (item == NULL) continue; item->Insert(); } status_t result = fParser->Device()->SendReport(this); fCurrentReport = NULL; free(report); return result; }