use calloc instead

This commit is contained in:
iceman1001 committed 2022-01-09 00:33:33 +01:00
1 parent 0254b2a63a
commit fe9348768d
22 files changed
+70 -69

No files matched your search

+3 -3
View File
@@ -82,7 +82,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
char *prefix = strdup(pcPortName);
if (prefix == NULL) {
PrintAndLogEx(ERR, "error: malloc");
PrintAndLogEx(ERR, "error: string duplication");
free(sp);
return INVALID_SERIAL_PORT;
}
@@ -100,7 +100,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
char *addrstr = strdup(pcPortName + 4);
if (addrstr == NULL) {
PrintAndLogEx(ERR, "error: malloc");
PrintAndLogEx(ERR, "error: string duplication");
free(sp);
return INVALID_SERIAL_PORT;
}
@@ -175,7 +175,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
char *addrstr = strndup(pcPortName + 3, 17);
if (addrstr == NULL) {
PrintAndLogEx(ERR, "error: malloc");
PrintAndLogEx(ERR, "error: string duplication");
free(sp);
return INVALID_SERIAL_PORT;
}