diff --git a/TEST_APPS/device/socket_app/cmd_socket.cpp b/TEST_APPS/device/socket_app/cmd_socket.cpp index 7ecf176133e..d07c4e8f005 100644 --- a/TEST_APPS/device/socket_app/cmd_socket.cpp +++ b/TEST_APPS/device/socket_app/cmd_socket.cpp @@ -673,6 +673,7 @@ static nsapi_size_or_error_t start_udp_receiver_thread(SInfo *info, int argc, ch int *packetSizes = new (nothrow) int[PACKET_SIZE_ARRAY_LEN]; if (!packetSizes) { cmd_printf("Allocation failed\r\n"); + free(dataIn); return CMDLINE_RETCODE_FAIL; } for (int i = 0; i < PACKET_SIZE_ARRAY_LEN; i++) { diff --git a/UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/at_cellularnetworktest.cpp b/UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/at_cellularnetworktest.cpp index f755e557caa..25ed6116b76 100644 --- a/UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/at_cellularnetworktest.cpp +++ b/UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/at_cellularnetworktest.cpp @@ -122,6 +122,7 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_get_registration_params) EXPECT_TRUE(reg_params._status == CellularNetwork::RegistrationDenied); EXPECT_TRUE(reg_params._act == CellularNetwork::RAT_EGPRS); EXPECT_TRUE(reg_params._cell_id == -1); + EXPECT_TRUE(reg_params._lac == -1); ATHandler_stub::read_string_index = 4; ATHandler_stub::read_string_table[3] = "00C3"; @@ -129,6 +130,7 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_get_registration_params) ATHandler_stub::read_string_table[1] = "00100100"; ATHandler_stub::read_string_table[0] = "01000111"; EXPECT_TRUE(NSAPI_ERROR_OK == cn.get_registration_params(CellularNetwork::C_EREG, reg_params)); + EXPECT_TRUE(reg_params._lac == 0xc3); EXPECT_TRUE(reg_params._cell_id == 305463233); EXPECT_TRUE(reg_params._active_time == 240); EXPECT_TRUE(reg_params._periodic_tau == 70 * 60 * 60); diff --git a/features/FEATURE_BLE/source/generic/GenericSecurityManager.tpp b/features/FEATURE_BLE/source/generic/GenericSecurityManager.tpp index 6422f28336e..8fe96244637 100644 --- a/features/FEATURE_BLE/source/generic/GenericSecurityManager.tpp +++ b/features/FEATURE_BLE/source/generic/GenericSecurityManager.tpp @@ -883,9 +883,8 @@ ble_error_t GenericSecurityManager::init_si const csrk_t *pcsrk = _db->get_local_csrk(); sign_count_t local_sign_counter = _db->get_local_sign_counter(); + csrk_t csrk; if (!pcsrk) { - csrk_t csrk; - ble_error_t ret = get_random_data(csrk.data(), csrk.size()); if (ret != BLE_ERROR_NONE) { return ret; diff --git a/features/cellular/framework/AT/AT_CellularNetwork.cpp b/features/cellular/framework/AT/AT_CellularNetwork.cpp index f029aed5f1c..4d0591e963a 100644 --- a/features/cellular/framework/AT/AT_CellularNetwork.cpp +++ b/features/cellular/framework/AT/AT_CellularNetwork.cpp @@ -177,6 +177,7 @@ void AT_CellularNetwork::read_reg_params_and_compare(RegistrationType type) } if (reg_params._cell_id != -1 && reg_params._cell_id != _reg_params._cell_id) { _reg_params._cell_id = reg_params._cell_id; + _reg_params._lac = reg_params._lac; data.status_data = reg_params._cell_id; _connection_status_cb((nsapi_event_t)CellularCellIDChanged, (intptr_t)&data); } diff --git a/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp b/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp index 1cb87db3655..63cfd474fb4 100644 --- a/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp +++ b/features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp @@ -190,7 +190,7 @@ nsapi_size_or_error_t QUECTEL_BC95_CellularStack::socket_sendto_impl(CellularSoc _at.write_int(socket->id); _at.write_int(size); } else { - delete hexstr; + delete [] hexstr; return NSAPI_ERROR_PARAMETER; } @@ -202,7 +202,7 @@ nsapi_size_or_error_t QUECTEL_BC95_CellularStack::socket_sendto_impl(CellularSoc sent_len = _at.read_int(); _at.resp_stop(); - delete hexstr; + delete [] hexstr; if (_at.get_last_error() == NSAPI_ERROR_OK) { return sent_len; diff --git a/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp b/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp index f45568cba87..b998dd2077c 100644 --- a/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp +++ b/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp @@ -20,6 +20,7 @@ #include "QUECTEL_BG96_CellularStack.h" #include "QUECTEL_BG96_CellularInformation.h" #include "QUECTEL_BG96_CellularContext.h" +#include "CellularLog.h" using namespace mbed; using namespace events; diff --git a/targets/TARGET_Atmel/TARGET_SAM_CortexM0P/TARGET_SAML21J18A/analogout_api.c b/targets/TARGET_Atmel/TARGET_SAM_CortexM0P/TARGET_SAML21J18A/analogout_api.c index 773f113cdb5..a548f381c9d 100644 --- a/targets/TARGET_Atmel/TARGET_SAM_CortexM0P/TARGET_SAML21J18A/analogout_api.c +++ b/targets/TARGET_Atmel/TARGET_SAM_CortexM0P/TARGET_SAML21J18A/analogout_api.c @@ -21,6 +21,8 @@ #include "PeripheralPins.h" #include "dac.h" +#if DEVICE_ANALOGOUT + extern uint8_t g_sys_init; #define MAX_VAL_12BIT 0x0FFF /*12 Bit DAC for SAML21*/ @@ -119,4 +121,5 @@ const PinMap *analogout_pinmap() { return PinMap_DAC; } -#endif + +#endif // DEVICE_ANALOGOUT diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8C62XX/TARGET_MCU_PSOC6_M0/system_psoc6_cm0plus.c b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8C62XX/TARGET_MCU_PSOC6_M0/system_psoc6_cm0plus.c index 0c760e5956a..d91a914740c 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8C62XX/TARGET_MCU_PSOC6_M0/system_psoc6_cm0plus.c +++ b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8C62XX/TARGET_MCU_PSOC6_M0/system_psoc6_cm0plus.c @@ -193,13 +193,6 @@ void mailbox_init(void); *******************************************************************************/ void SystemInit(void) { - /* Workaround to avoid twice SystemInit() call when ARMC5 compiler is used */ - static uint32_t temp_var = 0; - - if (temp_var == 0) - { - temp_var = 1; - Cy_PDL_Init(CY_DEVICE_CFG); /* Restore FLL registers to the default state as they are not restored by the ROM code */ @@ -299,8 +292,6 @@ void SystemInit(void) #else/* !defined(CY_IPC_DEFAULT_CFG_DISABLE) */ Cy_SemaIpcFlashInit(); #endif /* !defined(CY_IPC_DEFAULT_CFG_DISABLE) */ - - } } diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8C62XX/device/system_psoc6.h b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8C62XX/device/system_psoc6.h index 6dcb0ce124d..f4d7bf67244 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8C62XX/device/system_psoc6.h +++ b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8C62XX/device/system_psoc6.h @@ -539,11 +539,7 @@ extern "C" { * \addtogroup group_system_config_system_functions * \{ */ -#if defined(__ARMCC_VERSION) - extern void SystemInit(void) __attribute__((constructor)); -#else - extern void SystemInit(void); -#endif /* (__ARMCC_VERSION) */ +extern void SystemInit(void); extern void SystemCoreClockUpdate(void); /** \} group_system_config_system_functions */ diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_4343W/device/system_psoc6.h b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_4343W/device/system_psoc6.h index 6dcb0ce124d..f4d7bf67244 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_4343W/device/system_psoc6.h +++ b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_4343W/device/system_psoc6.h @@ -539,11 +539,7 @@ extern "C" { * \addtogroup group_system_config_system_functions * \{ */ -#if defined(__ARMCC_VERSION) - extern void SystemInit(void) __attribute__((constructor)); -#else - extern void SystemInit(void); -#endif /* (__ARMCC_VERSION) */ +extern void SystemInit(void); extern void SystemCoreClockUpdate(void); /** \} group_system_config_system_functions */ diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_BLE/device/system_psoc6.h b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_BLE/device/system_psoc6.h index 6dcb0ce124d..f4d7bf67244 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_BLE/device/system_psoc6.h +++ b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_BLE/device/system_psoc6.h @@ -539,11 +539,7 @@ extern "C" { * \addtogroup group_system_config_system_functions * \{ */ -#if defined(__ARMCC_VERSION) - extern void SystemInit(void) __attribute__((constructor)); -#else - extern void SystemInit(void); -#endif /* (__ARMCC_VERSION) */ +extern void SystemInit(void); extern void SystemCoreClockUpdate(void); /** \} group_system_config_system_functions */ diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CMOD_062_4343W/device/system_psoc6.h b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CMOD_062_4343W/device/system_psoc6.h index 6dcb0ce124d..f4d7bf67244 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CMOD_062_4343W/device/system_psoc6.h +++ b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CMOD_062_4343W/device/system_psoc6.h @@ -539,11 +539,7 @@ extern "C" { * \addtogroup group_system_config_system_functions * \{ */ -#if defined(__ARMCC_VERSION) - extern void SystemInit(void) __attribute__((constructor)); -#else - extern void SystemInit(void); -#endif /* (__ARMCC_VERSION) */ +extern void SystemInit(void); extern void SystemCoreClockUpdate(void); /** \} group_system_config_system_functions */ diff --git a/targets/TARGET_GigaDevice/TARGET_GD32E10X/can_api.c b/targets/TARGET_GigaDevice/TARGET_GD32E10X/can_api.c index df449bbad84..1b7bfe07549 100644 --- a/targets/TARGET_GigaDevice/TARGET_GD32E10X/can_api.c +++ b/targets/TARGET_GigaDevice/TARGET_GD32E10X/can_api.c @@ -305,7 +305,7 @@ void can_free(can_t *obj) */ int can_frequency(can_t *obj, int hz) { - int reval; + int reval = 0; /* The maximum baud rate support to 1M */ if (hz <= 1000000) { diff --git a/targets/TARGET_GigaDevice/TARGET_GD32F30X/can_api.c b/targets/TARGET_GigaDevice/TARGET_GD32F30X/can_api.c index b93a5cf1ce7..db92b9db4da 100644 --- a/targets/TARGET_GigaDevice/TARGET_GD32F30X/can_api.c +++ b/targets/TARGET_GigaDevice/TARGET_GD32F30X/can_api.c @@ -305,7 +305,7 @@ void can_free(can_t *obj) */ int can_frequency(can_t *obj, int hz) { - int reval; + int reval = 0; /* The maximum baud rate support to 1M */ if (hz <= 1000000) { diff --git a/targets/TARGET_GigaDevice/TARGET_GD32F4XX/can_api.c b/targets/TARGET_GigaDevice/TARGET_GD32F4XX/can_api.c index 65a5ed54d47..15c67b17260 100644 --- a/targets/TARGET_GigaDevice/TARGET_GD32F4XX/can_api.c +++ b/targets/TARGET_GigaDevice/TARGET_GD32F4XX/can_api.c @@ -306,7 +306,7 @@ void can_free(can_t *obj) */ int can_frequency(can_t *obj, int hz) { - int reval; + int reval = 0; /* The maximum baud rate support to 1M */ if (hz <= 1000000) { diff --git a/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H743xI/TARGET_NUCLEO_H743ZI/PeripheralPins.c b/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H743xI/TARGET_NUCLEO_H743ZI/PeripheralPins.c index 92742558d99..503d39e94d4 100644 --- a/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H743xI/TARGET_NUCLEO_H743ZI/PeripheralPins.c +++ b/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H743xI/TARGET_NUCLEO_H743ZI/PeripheralPins.c @@ -106,8 +106,8 @@ MBED_WEAK const PinMap PinMap_ADC[] = { {PF_8, ADC_3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC3_INN3 {PF_8_ALT0, ADC_3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC3_INP7 {PF_9, ADC_3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC3_INP2 - {PF_10, ADC_3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC3_INN2 - {PF_10_ALT0, ADC_3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC3_INP6 + {PF_10_ALT0, ADC_3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC3_INN2 + {PF_10, ADC_3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC3_INP6 {PF_11, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_INP2 {PF_12, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_INN2 {PF_12_ALT0, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_INP6 diff --git a/targets/TARGET_TOSHIBA/TARGET_TMPM46B/i2c_api.c b/targets/TARGET_TOSHIBA/TARGET_TMPM46B/i2c_api.c index f75894b1024..6ae3ba89193 100644 --- a/targets/TARGET_TOSHIBA/TARGET_TMPM46B/i2c_api.c +++ b/targets/TARGET_TOSHIBA/TARGET_TMPM46B/i2c_api.c @@ -219,6 +219,10 @@ int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) i2c_num = obj->index; gI2C_TxData = (char *)calloc(length, sizeof(int8_t)); + if (gI2C_TxData == NULL) { + error("Insufficient memory"); + return 0; + } for (i = 0; i < length; i++) { gI2C_TxData[i] = data[i]; @@ -258,6 +262,10 @@ int i2c_byte_write(i2c_t *obj, int data) byte_func = 1; if (start_flag == 0 && send_byte == 0) { gI2C_LTxData = (char *)realloc(gI2C_LTxData, counter++); + if (gI2C_LTxData == NULL) { + error("Insufficient memory"); + return 0; + } gI2C_LTxData[counter - 2] = data; }