Skip to content

Commit 64df072

Browse files
authored
Merge pull request #11551 from Tharazi97/Coverity
Coverity updates
2 parents 917d982 + 62d0770 commit 64df072

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

components/wifi/esp8266-driver/ESP8266Interface.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@ ESP8266Interface::ESP8266Interface()
6767
_if_connected(_cmutex),
6868
_initialized(false),
6969
_connect_retval(NSAPI_ERROR_OK),
70+
_disconnect_retval(NSAPI_ERROR_OK),
7071
_conn_stat(NSAPI_STATUS_DISCONNECTED),
7172
_conn_stat_cb(NULL),
7273
_global_event_queue(mbed_event_queue()), // Needs to be set before attaching event() to SIGIO
7374
_oob_event_id(0),
7475
_connect_event_id(0),
76+
_disconnect_event_id(0),
7577
_software_conn_stat(IFACE_STATUS_DISCONNECTED)
7678
{
7779
memset(_cbs, 0, sizeof(_cbs));
@@ -105,11 +107,14 @@ ESP8266Interface::ESP8266Interface(PinName tx, PinName rx, bool debug, PinName r
105107
_if_connected(_cmutex),
106108
_initialized(false),
107109
_connect_retval(NSAPI_ERROR_OK),
110+
_disconnect_retval(NSAPI_ERROR_OK),
108111
_conn_stat(NSAPI_STATUS_DISCONNECTED),
109112
_conn_stat_cb(NULL),
110113
_global_event_queue(mbed_event_queue()), // Needs to be set before attaching event() to SIGIO
111114
_oob_event_id(0),
112-
_connect_event_id(0)
115+
_connect_event_id(0),
116+
_disconnect_event_id(0),
117+
_software_conn_stat(IFACE_STATUS_DISCONNECTED)
113118
{
114119
memset(_cbs, 0, sizeof(_cbs));
115120
memset(ap_ssid, 0, sizeof(ap_ssid));

features/nfc/source/nfc/NFCEEPROM.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ using namespace mbed;
2121
using namespace mbed::nfc;
2222

2323
NFCEEPROM::NFCEEPROM(NFCEEPROMDriver *driver, events::EventQueue *queue, const Span<uint8_t> &ndef_buffer) : NFCTarget(ndef_buffer),
24-
_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)
24+
_delegate(NULL), _driver(driver), _event_queue(queue), _initialized(false), _current_op(nfc_eeprom_idle), _ndef_buffer_read_sz(0), _eeprom_address(0),
25+
_operation_result(NFC_ERR_UNKNOWN), _ndef_buffer_reader{nullptr, 0, nullptr}
2526
{
2627
_driver->set_delegate(this);
2728
_driver->set_event_queue(queue);

features/nfc/source/nfc/ndef/common/Text.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ Text::Text(const Text &other) :
4141
_text_record(other._text_record ? new uint8_t[other._text_record_size] : NULL),
4242
_text_record_size(other._text_record_size)
4343
{
44-
memcpy(_text_record, other._text_record, _text_record_size);
44+
if (_text_record) {
45+
memcpy(_text_record, other._text_record, _text_record_size);
46+
}
4547
}
4648

4749
Text::Text(

features/nfc/source/nfc/ndef/common/URI.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,19 @@ URI::URI(uri_identifier_code_t id, const Span<const uint8_t> &uri_field) :
4040
_uri(uri_field.size() ? new uint8_t[uri_id_code_size + uri_field.size()] : NULL),
4141
_uri_size(uri_id_code_size + uri_field.size())
4242
{
43-
_uri[uri_id_index] = id;
44-
memcpy(_uri + uri_field_index, uri_field.data(), uri_field.size());
43+
if (_uri) {
44+
_uri[uri_id_index] = id;
45+
memcpy(_uri + uri_field_index, uri_field.data(), uri_field.size());
46+
}
4547
}
4648

4749
URI::URI(const URI &other) :
4850
_uri(other._uri ? new uint8_t[other._uri_size] : NULL),
4951
_uri_size(other._uri_size)
5052
{
51-
memcpy(_uri, other._uri, other._uri_size);
53+
if (_uri) {
54+
memcpy(_uri, other._uri, other._uri_size);
55+
}
5256
}
5357

5458
URI::~URI()

0 commit comments

Comments
 (0)