Skip to content

Commit 35ef1c6

Browse files
andyp1pertridge
authored andcommitted
AP_RCTelemetry: check for allocation failure in CRSF scripting
1 parent 5dec86f commit 35ef1c6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libraries/AP_RCTelemetry/AP_CRSF_Telem.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,6 @@ bool AP_CRSF_Telem::_process_frame(AP_RCProtocol_CRSF::FrameType frame_type, voi
525525
// this means we are connected to an RC receiver and can send telemetry
526526
case AP_RCProtocol_CRSF::CRSF_FRAMETYPE_RC_CHANNELS_PACKED:
527527
case AP_RCProtocol_CRSF::CRSF_FRAMETYPE_SUBSET_RC_CHANNELS_PACKED:
528-
case AP_RCProtocol_CRSF::CRSF_FRAMETYPE_RC_CHANNELS_PACKED_11BIT:
529528
// the EVO sends battery frames and we should send telemetry back to populate the OSD
530529
case AP_RCProtocol_CRSF::CRSF_FRAMETYPE_BATTERY_SENSOR:
531530
_enable_telemetry = true;
@@ -1670,6 +1669,9 @@ bool AP_CRSF_Telem::send_write_response(uint8_t length, const char* data)
16701669
case ScriptedParameterEvents::PARAMETER_READ:
16711670
// respond with parameter entry updated with the new data
16721671
spw.param->data = (const char*)hal.util->std_realloc((char*)spw.param->data, length);
1672+
if (spw.param->data == nullptr) {
1673+
return false;
1674+
}
16731675
memcpy((char*)spw.param->data, data, length);
16741676
spw.param->length = length;
16751677
send_response(spw);

0 commit comments

Comments
 (0)