Fix some missing frees, null dereferences and missing initialisation picked up by clang-analyzer

This commit is contained in:
nvx committed 2024-01-16 00:22:53 +10:00
1 parent 5db2276602
commit d2d6f80d11
11 files changed
+24 -15

No files matched your search

+2 -1
View File
@@ -85,13 +85,14 @@ static int uart_reconfigure_timeouts_polling(serial_port sp) {
serial_port uart_open(const char *pcPortName, uint32_t speed, bool slient) {
char acPortName[255] = {0};
serial_port_windows_t *sp = calloc(sizeof(serial_port_windows_t), sizeof(uint8_t));
sp->hSocket = INVALID_SOCKET; // default: serial port
if (sp == 0) {
PrintAndLogEx(WARNING, "UART failed to allocate memory\n");
return INVALID_SERIAL_PORT;
}
sp->hSocket = INVALID_SOCKET; // default: serial port
sp->udpBuffer = NULL;
rx_empty_counter = 0;
g_conn.send_via_local_ip = false;