diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2017-01-23 14:51:10 +0100 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2017-01-24 15:34:20 +0100 |
commit | 30ac37b20b63f468aff234639bdba7ad73f02b40 (patch) | |
tree | 36d35d9198bd580f1380c2814434cec14dba01ed /utils/hwstub | |
parent | dd7f834e612e05f2d0be90174fa3380008a98ba7 (diff) | |
download | rockbox-30ac37b20b63f468aff234639bdba7ad73f02b40.tar.gz rockbox-30ac37b20b63f468aff234639bdba7ad73f02b40.zip |
hwstub: fix memory leak in net backend
Change-Id: I98bef5aa0c518e698c42761d02899adde8bc4aca
Diffstat (limited to 'utils/hwstub')
-rw-r--r-- | utils/hwstub/lib/hwstub_net.cpp | 2 |
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 | |||
135 | int err = getaddrinfo(domain.c_str(), port.c_str(), &hints, &result); | 135 | int err = getaddrinfo(domain.c_str(), port.c_str(), &hints, &result); |
136 | if(err != 0) | 136 | if(err != 0) |
137 | { | 137 | { |
138 | freeaddrinfo(result); | ||
138 | if(error) | 139 | if(error) |
139 | *error = std::string("getaddrinfo failed: ") + gai_strerror(err); | 140 | *error = std::string("getaddrinfo failed: ") + gai_strerror(err); |
140 | return -1; | 141 | return -1; |
@@ -163,6 +164,7 @@ namespace | |||
163 | else | 164 | else |
164 | break; /* success */ | 165 | break; /* success */ |
165 | } | 166 | } |
167 | freeaddrinfo(result); | ||
166 | /* no address was tried */ | 168 | /* no address was tried */ |
167 | if(socket_fd < 0 && error) | 169 | if(socket_fd < 0 && error) |
168 | *error = "getaddrinfo() returned no usable result (socket()/connect()/bind() failed)"; | 170 | *error = "getaddrinfo() returned no usable result (socket()/connect()/bind() failed)"; |