Skip to content
Permalink
Browse files

Merge pull request #137 from kprinssu/fix-memleaks

Fix memory leaks in native simulator
  • Loading branch information...
alexandred committed Nov 26, 2018
2 parents 32a7c6f + e7f6637 commit 852c48f290512435c92ddaf6c33d0a468ab248ff
Showing with 4 additions and 26 deletions.
  1. +4 −26 Multitouch Support/Native/VoodooI2CMT2SimulatorDevice.cpp
@@ -224,7 +224,9 @@ void VoodooI2CMT2SimulatorDevice::constructReportGated(VoodooI2CMultitouchEvent&
buffer_report->writeBytes(0, &input_report, total_report_len);

handleReport(buffer_report, kIOHIDReportTypeInput);

buffer_report->release();
buffer_report = NULL;

if (!input_active) {
input_report.FINGERS[0].Size = 0x0;
input_report.FINGERS[0].Pressure = 0x0;
@@ -233,38 +235,14 @@ void VoodooI2CMT2SimulatorDevice::constructReportGated(VoodooI2CMultitouchEvent&

milli_timestamp += 10;

input_report.timestamp_buffer[0] = (milli_timestamp << 0x3) | 0x4;
input_report.timestamp_buffer[1] = (milli_timestamp >> 0x5) & 0xFF;
input_report.timestamp_buffer[2] = (milli_timestamp >> 0xd) & 0xFF;

buffer_report = IOBufferMemoryDescriptor::inTaskWithOptions(kernel_task, 0, total_report_len);
buffer_report->writeBytes(0, &input_report, total_report_len);

input_report.FINGERS[0].AbsY[1] &= ~0xF4;
input_report.FINGERS[0].AbsY[1] |= 0x14;

buffer_report = IOBufferMemoryDescriptor::inTaskWithOptions(kernel_task, 0, total_report_len);
buffer_report->writeBytes(0, &input_report, total_report_len);

milli_timestamp += 10;

input_report.timestamp_buffer[0] = (milli_timestamp << 0x3) | 0x4;
input_report.timestamp_buffer[1] = (milli_timestamp >> 0x5) & 0xFF;
input_report.timestamp_buffer[2] = (milli_timestamp >> 0xd) & 0xFF;

buffer_report = IOBufferMemoryDescriptor::inTaskWithOptions(kernel_task, 0, total_report_len);
buffer_report->writeBytes(0, &input_report, total_report_len);

milli_timestamp += 10;

input_report.timestamp_buffer[0] = (milli_timestamp << 0x3) | 0x4;
input_report.timestamp_buffer[1] = (milli_timestamp >> 0x5) & 0xFF;
input_report.timestamp_buffer[2] = (milli_timestamp >> 0xd) & 0xFF;

buffer_report = IOBufferMemoryDescriptor::inTaskWithOptions(kernel_task, 0, 12);
buffer_report->writeBytes(0, &input_report, 12);
handleReport(buffer_report, kIOHIDReportTypeInput);

buffer_report->release();
}

input_report = {};

0 comments on commit 852c48f

Please sign in to comment.
You can’t perform that action at this time.