Memory fixes
This commit is contained in:
+9
-1
@@ -20,6 +20,10 @@ IrcUri::~IrcUri(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CURL_FOUND
|
||||
#include <curl/curl.h>
|
||||
#endif
|
||||
|
||||
const std::optional<std::string> IrcUri::get_server(void) const {
|
||||
#ifdef CURL_FOUND
|
||||
char *server;
|
||||
@@ -27,7 +31,9 @@ const std::optional<std::string> IrcUri::get_server(void) const {
|
||||
if (rc) {
|
||||
return std::nullopt;
|
||||
}
|
||||
return server;
|
||||
std::string result(server);
|
||||
curl_free(server);
|
||||
return result;
|
||||
#else
|
||||
return std::nullopt;
|
||||
#endif // CURL_FOUND
|
||||
@@ -42,6 +48,7 @@ const std::optional<std::string> IrcUri::get_entity(void) const {
|
||||
if (rc)
|
||||
return std::nullopt;
|
||||
output = entity;
|
||||
curl_free(entity);
|
||||
if (!output.empty())
|
||||
output.erase(0, 1);
|
||||
if (output.empty()) {
|
||||
@@ -49,6 +56,7 @@ const std::optional<std::string> IrcUri::get_entity(void) const {
|
||||
if (rc)
|
||||
return std::nullopt;
|
||||
output = entity;
|
||||
curl_free(entity);
|
||||
output.insert(0, 1, '#');
|
||||
}
|
||||
return IrcUri::parse_entity(output);
|
||||
|
||||
Reference in New Issue
Block a user