Commit 3d03e46d authored by François Grisez's avatar François Grisez

Fix memory leak in ExternalListSubscription::getUsersList(const string &,...

Fix memory leak in ExternalListSubscription::getUsersList(const string &, belle_sip_server_transaction_t *)
parent cddbf607
Pipeline #6575 passed with stages
in 42 minutes and 49 seconds
......@@ -69,21 +69,23 @@ void ExternalListSubscription::getUsersList(const string &sqlRequest, belle_sip_
string addrStr;
for (const auto &row : ret) {
addrStr = row.get<string>(0);
belle_sip_header_address_t *addr = belle_sip_header_address_parse(addrStr.c_str());
if (!addr) {
unique_ptr<belle_sip_header_address_t, void(*)(void *)> addr(
belle_sip_header_address_parse(addrStr.c_str()),
belle_sip_object_unref
);
if (addr == nullptr) {
ostringstream os;
os << "Cannot parse list entry [" << addrStr << "]";
continue;
}
belle_sip_uri_t *uri = belle_sip_header_address_get_uri(addr);
const belle_sip_uri_t *uri = belle_sip_header_address_get_uri(addr.get());
if (!uri || !belle_sip_uri_get_host(uri) || !belle_sip_uri_get_user(uri)) {
ostringstream os;
os << "Cannot parse list entry [" << addrStr << "]";
continue;
}
const char *name = belle_sip_header_address_get_displayname(addr);
const char *name = belle_sip_header_address_get_displayname(addr.get());
mListeners.push_back(make_shared<PresentityResourceListener>(*this, uri, name ? name : ""));
belle_sip_object_unref(uri); // Because PresentityResourceListener takes its own ref
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment