fix: mem leaks

This commit is contained in:
iceman1001 2019-02-21 16:07:14 +01:00
parent de317d9f48
commit 00d1fd9d45

View file

@ -103,6 +103,8 @@ serial_port uart_open(const char* pcPortName)
int s = getaddrinfo(addrstr, portstr, NULL, &addr);
if (s != 0) {
printf("Error: getaddrinfo: %s\n", gai_strerror(s));
freeaddrinfo(addr);
free(addrstr);
return INVALID_SERIAL_PORT;
}
@ -121,6 +123,8 @@ serial_port uart_open(const char* pcPortName)
if (rp == NULL) { /* No address succeeded */
printf("Error: Could not connect\n");
freeaddrinfo(addr);
free(addrstr);
return INVALID_SERIAL_PORT;
}