diff options
author | louiz’ <louiz@louiz.org> | 2017-02-15 01:46:29 +0100 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2017-02-15 01:46:29 +0100 |
commit | 679bf94192695f2d6e7fe7e991bf490f95f63d25 (patch) | |
tree | a763c0d98864e52f12e51d34a8d9b08a894e117c | |
parent | efb8a11c5763632eee0fffea190a90712c6373f0 (diff) | |
download | biboumi-679bf94192695f2d6e7fe7e991bf490f95f63d25.tar.gz biboumi-679bf94192695f2d6e7fe7e991bf490f95f63d25.tar.bz2 biboumi-679bf94192695f2d6e7fe7e991bf490f95f63d25.tar.xz biboumi-679bf94192695f2d6e7fe7e991bf490f95f63d25.zip |
Only call freeaddrinfo if an actual addrinfo struct has been allocated
-rw-r--r-- | louloulibs/xmpp/jid.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/louloulibs/xmpp/jid.cpp b/louloulibs/xmpp/jid.cpp index 5862599..46e01ea 100644 --- a/louloulibs/xmpp/jid.cpp +++ b/louloulibs/xmpp/jid.cpp @@ -75,7 +75,7 @@ std::string jidprep(const std::string& original) struct addrinfo* addr_res = nullptr; const auto ret = ::getaddrinfo(domain, nullptr, &hints, &addr_res); - auto addrinfo_deleter = utils::make_scope_guard([addr_res] { freeaddrinfo(addr_res); }); + auto addrinfo_deleter = utils::make_scope_guard([addr_res] { if (addr_res) freeaddrinfo(addr_res); }); if (ret || !addr_res || (addr_res->ai_family != AF_INET && addr_res->ai_family != AF_INET6)) { // Not an IP, run nameprep on it rc = static_cast<Stringprep_rc>(::stringprep(domain, max_jid_part_len, |