summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2017-01-23 14:51:10 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2017-01-24 15:34:20 +0100
commit30ac37b20b63f468aff234639bdba7ad73f02b40 (patch)
tree36d35d9198bd580f1380c2814434cec14dba01ed
parentdd7f834e612e05f2d0be90174fa3380008a98ba7 (diff)
downloadrockbox-30ac37b20b63f468aff234639bdba7ad73f02b40.tar.gz
rockbox-30ac37b20b63f468aff234639bdba7ad73f02b40.tar.bz2
rockbox-30ac37b20b63f468aff234639bdba7ad73f02b40.zip
hwstub: fix memory leak in net backend
Change-Id: I98bef5aa0c518e698c42761d02899adde8bc4aca
-rw-r--r--utils/hwstub/lib/hwstub_net.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/utils/hwstub/lib/hwstub_net.cpp b/utils/hwstub/lib/hwstub_net.cpp
index c9d201a761..1d2fb2402b 100644
--- a/utils/hwstub/lib/hwstub_net.cpp
+++ b/utils/hwstub/lib/hwstub_net.cpp
@@ -135,6 +135,7 @@ namespace
int err = getaddrinfo(domain.c_str(), port.c_str(), &hints, &result);
if(err != 0)
{
+ freeaddrinfo(result);
if(error)
*error = std::string("getaddrinfo failed: ") + gai_strerror(err);
return -1;
@@ -163,6 +164,7 @@ namespace
else
break; /* success */
}
+ freeaddrinfo(result);
/* no address was tried */
if(socket_fd < 0 && error)
*error = "getaddrinfo() returned no usable result (socket()/connect()/bind() failed)";