diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-08-27 22:21:07 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-08-30 15:03:59 +0100 |
commit | 4ef0da184d18f15e1a16c34f898483dc50b125d7 (patch) | |
tree | d60f9a0decdd7d050d38af9d04f9690adfdfed21 /src/common | |
parent | dns_utils: add a const where possible (diff) | |
download | monero-4ef0da184d18f15e1a16c34f898483dc50b125d7.tar.xz |
dns_utils: simplify string handling and fix leak
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/dns_utils.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/common/dns_utils.cpp b/src/common/dns_utils.cpp index d8b3c5308..33e71c79d 100644 --- a/src/common/dns_utils.cpp +++ b/src/common/dns_utils.cpp @@ -301,11 +301,7 @@ std::vector<std::string> DNSResolver::get_txt_record(const std::string& url, boo { for (size_t i=0; result->data[i] != NULL; i++) { - // plz fix this, but this does NOT work and spills over into parts of memory it shouldn't: records.push_back(result.ptr->data[i]); - char *restxt; - restxt = (char*) calloc(result->len[i]+1, 1); - memcpy(restxt, result->data[i]+1, result->len[i]-1); - records.push_back(restxt); + records.push_back(std::string(result->data[i]+1, result->len[i]-1)); } } } |