diff --git a/components/wifi/esp8266-driver/ESP8266Interface.cpp b/components/wifi/esp8266-driver/ESP8266Interface.cpp index 2b44dcd826..ff8e790688 100644 --- a/components/wifi/esp8266-driver/ESP8266Interface.cpp +++ b/components/wifi/esp8266-driver/ESP8266Interface.cpp @@ -67,11 +67,13 @@ ESP8266Interface::ESP8266Interface() _if_connected(_cmutex), _initialized(false), _connect_retval(NSAPI_ERROR_OK), + _disconnect_retval(NSAPI_ERROR_OK), _conn_stat(NSAPI_STATUS_DISCONNECTED), _conn_stat_cb(NULL), _global_event_queue(mbed_event_queue()), // Needs to be set before attaching event() to SIGIO _oob_event_id(0), _connect_event_id(0), + _disconnect_event_id(0), _software_conn_stat(IFACE_STATUS_DISCONNECTED) { memset(_cbs, 0, sizeof(_cbs)); @@ -105,11 +107,14 @@ ESP8266Interface::ESP8266Interface(PinName tx, PinName rx, bool debug, PinName r _if_connected(_cmutex), _initialized(false), _connect_retval(NSAPI_ERROR_OK), + _disconnect_retval(NSAPI_ERROR_OK), _conn_stat(NSAPI_STATUS_DISCONNECTED), _conn_stat_cb(NULL), _global_event_queue(mbed_event_queue()), // Needs to be set before attaching event() to SIGIO _oob_event_id(0), - _connect_event_id(0) + _connect_event_id(0), + _disconnect_event_id(0), + _software_conn_stat(IFACE_STATUS_DISCONNECTED) { memset(_cbs, 0, sizeof(_cbs)); memset(ap_ssid, 0, sizeof(ap_ssid)); diff --git a/features/nfc/source/nfc/NFCEEPROM.cpp b/features/nfc/source/nfc/NFCEEPROM.cpp index 01f2715a85..1872376817 100644 --- a/features/nfc/source/nfc/NFCEEPROM.cpp +++ b/features/nfc/source/nfc/NFCEEPROM.cpp @@ -21,7 +21,8 @@ using namespace mbed; using namespace mbed::nfc; NFCEEPROM::NFCEEPROM(NFCEEPROMDriver *driver, events::EventQueue *queue, const Span &ndef_buffer) : NFCTarget(ndef_buffer), - _delegate(NULL), _driver(driver), _event_queue(queue), _initialized(false), _current_op(nfc_eeprom_idle), _ndef_buffer_read_sz(0), _eeprom_address(0), _operation_result(NFC_ERR_UNKNOWN) + _delegate(NULL), _driver(driver), _event_queue(queue), _initialized(false), _current_op(nfc_eeprom_idle), _ndef_buffer_read_sz(0), _eeprom_address(0), + _operation_result(NFC_ERR_UNKNOWN), _ndef_buffer_reader{nullptr, 0, nullptr} { _driver->set_delegate(this); _driver->set_event_queue(queue); diff --git a/features/nfc/source/nfc/ndef/common/Text.cpp b/features/nfc/source/nfc/ndef/common/Text.cpp index b4d18e173b..6ea37be143 100644 --- a/features/nfc/source/nfc/ndef/common/Text.cpp +++ b/features/nfc/source/nfc/ndef/common/Text.cpp @@ -41,7 +41,9 @@ Text::Text(const Text &other) : _text_record(other._text_record ? new uint8_t[other._text_record_size] : NULL), _text_record_size(other._text_record_size) { - memcpy(_text_record, other._text_record, _text_record_size); + if (_text_record) { + memcpy(_text_record, other._text_record, _text_record_size); + } } Text::Text( diff --git a/features/nfc/source/nfc/ndef/common/URI.cpp b/features/nfc/source/nfc/ndef/common/URI.cpp index a392868843..4761251ce1 100644 --- a/features/nfc/source/nfc/ndef/common/URI.cpp +++ b/features/nfc/source/nfc/ndef/common/URI.cpp @@ -40,15 +40,19 @@ URI::URI(uri_identifier_code_t id, const Span &uri_field) : _uri(uri_field.size() ? new uint8_t[uri_id_code_size + uri_field.size()] : NULL), _uri_size(uri_id_code_size + uri_field.size()) { - _uri[uri_id_index] = id; - memcpy(_uri + uri_field_index, uri_field.data(), uri_field.size()); + if (_uri) { + _uri[uri_id_index] = id; + memcpy(_uri + uri_field_index, uri_field.data(), uri_field.size()); + } } URI::URI(const URI &other) : _uri(other._uri ? new uint8_t[other._uri_size] : NULL), _uri_size(other._uri_size) { - memcpy(_uri, other._uri, other._uri_size); + if (_uri) { + memcpy(_uri, other._uri, other._uri_size); + } } URI::~URI()