Skip to content
Snippets Groups Projects
Commit 4ebdfc3b authored by Recolic Keghart's avatar Recolic Keghart
Browse files

quick_recvall memory leak

parent 7be50e77
No related branches found
No related tags found
No related merge requests found
...@@ -552,7 +552,9 @@ namespace rlib { ...@@ -552,7 +552,9 @@ namespace rlib {
static std::string quick_recvall(sockfd_t fd) { static std::string quick_recvall(sockfd_t fd) {
void *ptr = NULL; void *ptr = NULL;
auto size = recvall_ex(fd, &ptr, 0, MSG_NOSIGNAL); auto size = recvall_ex(fd, &ptr, 0, MSG_NOSIGNAL);
return std::string((char *)ptr, size); auto result = std::string((char *)ptr, size);
free(ptr);
return result;
} }
static void quick_send(sockfd_t fd, const std::string &data) { static void quick_send(sockfd_t fd, const std::string &data) {
sendn_ex(fd, data.data(), data.size(), MSG_NOSIGNAL); sendn_ex(fd, data.data(), data.size(), MSG_NOSIGNAL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment