Merge pull request #11551 from Tharazi97/Coverity

Coverity updates
pull/11678/head
Anna Bridge 2019-10-11 11:01:10 +01:00 committed by GitHub
commit 64df07288c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 6 deletions

View File

@ -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));

View File

@ -21,7 +21,8 @@ using namespace mbed;
using namespace mbed::nfc;
NFCEEPROM::NFCEEPROM(NFCEEPROMDriver *driver, events::EventQueue *queue, const Span<uint8_t> &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);

View File

@ -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(

View File

@ -40,15 +40,19 @@ URI::URI(uri_identifier_code_t id, const Span<const uint8_t> &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()