mirror of https://github.com/ARMmbed/mbed-os.git
resolved free and long datas
parent
dea37cb97e
commit
4ff7ebbb3f
|
@ -99,7 +99,6 @@ void NFCProcessEEPROM::on_ndef_message_written(nfc_err_t result)
|
|||
}
|
||||
// complete the async test method here
|
||||
cmd_ready(CMDLINE_RETCODE_SUCCESS);
|
||||
free(long_string); // free buffer allocated by the command class now
|
||||
}
|
||||
|
||||
void NFCProcessEEPROM::on_ndef_message_read(nfc_err_t result)
|
||||
|
|
|
@ -285,9 +285,8 @@ void NFCTestShim::cmd_erase()
|
|||
void NFCTestShim::cmd_write_long(char *text_string)
|
||||
{
|
||||
MessageBuilder builder(_ndef_poster_message);
|
||||
long_string = text_string; // copy the pointer and free it when the write completes
|
||||
Text text(Text::UTF8, span_from_cstr("en-US"),
|
||||
span_from_cstr((const char *)(long_string)));
|
||||
span_from_cstr((const char *)(text_string)));
|
||||
|
||||
text.append_as_record(builder, true);
|
||||
_ndef_write_buffer_used = builder.get_message().size();
|
||||
|
@ -299,8 +298,8 @@ void NFCTestShim::cmd_write_long(char *text_string)
|
|||
// not on a wire, and we just stored the message in _ndef_write_buffer above
|
||||
set_last_nfc_error(NFC_OK);
|
||||
cmd_ready(CMDLINE_RETCODE_SUCCESS);
|
||||
free(long_string); // free buffer allocated by the command class now
|
||||
#endif
|
||||
free(text_string); // free buffer allocated by the command class now
|
||||
trace_printf("NFCTestShim::write_long() exit\r\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,6 @@ protected:
|
|||
uint8_t _ndef_buffer[MBED_CONF_APP_TEST_NDEF_MSG_MAX]; // driver I/O buffer
|
||||
bool _discovery_restart; // default true, restart discovery loop again on remote disconnect
|
||||
events::EventQueue &_queue;
|
||||
char *long_string;
|
||||
};
|
||||
|
||||
// forward declare single instance
|
||||
|
|
|
@ -115,12 +115,13 @@ class NfcTestParsers(PluginBase):
|
|||
if data is not False:
|
||||
started_read_data = True
|
||||
if started_read_data: # read data until we see a }} pair
|
||||
values = self.find_all_hex_data(line, "([0-9a-f\s]*)")
|
||||
line_values = ""
|
||||
if "{{nfcmessage=" in line:
|
||||
line_values = line[13:]
|
||||
else:
|
||||
line_values = line
|
||||
values = self.find_all_hex_data(line_values, "([0-9a-f\s]*)")
|
||||
if values is not False:
|
||||
if "{{nfcmessage" in line:
|
||||
value = values[0] # first (and possibly only data line)
|
||||
else:
|
||||
value += values[0] # concatenate (2nd and possibly last data line)
|
||||
partial_data += value
|
||||
if PluginBase.find_one(line, ".*(}})") is not False: # search for end marker
|
||||
started_read_data = False
|
||||
|
|
Loading…
Reference in New Issue