From 00d1fd9d456fc022c7084bb7cf35c59872979dc1 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 21 Feb 2019 16:07:14 +0100 Subject: [PATCH] fix: mem leaks --- uart/uart_posix.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/uart/uart_posix.c b/uart/uart_posix.c index 093aaf363..49bcb9b8e 100644 --- a/uart/uart_posix.c +++ b/uart/uart_posix.c @@ -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; }