From a4b8b9d839c3fd3a0796737631d2d42e58661149 Mon Sep 17 00:00:00 2001 From: bqv Date: Sun, 23 Oct 2022 01:58:44 +0100 Subject: [PATCH] fix some mem errors --- account.cpp | 10 ---------- channel.cpp | 3 +-- config.cpp | 4 ++-- config.hh | 2 +- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/account.cpp b/account.cpp index 35d1865..246df14 100644 --- a/account.cpp +++ b/account.cpp @@ -299,16 +299,6 @@ weechat::account::~account() */ if (buffer) weechat_buffer_close(buffer); - - accounts.erase(name); - - /* close xmpp context */ - if (connection) - xmpp_conn_release(connection); - if (context) - xmpp_ctx_free(context); - - delete this; } void weechat::account::disconnect(int reconnect) diff --git a/channel.cpp b/channel.cpp index f7875d4..805683d 100644 --- a/channel.cpp +++ b/channel.cpp @@ -510,8 +510,7 @@ weechat::channel::member *weechat::channel::add_member(const char *id, const cha user = user::search(&account, id); - if (user && weechat_strcasecmp(user->id, id) == 0 - && type == weechat::channel::chat_type::MUC) + if (this->id == id && type == weechat::channel::chat_type::MUC) { weechat_printf_date_tags(buffer, 0, "log2", "%sMUC: %s", weechat_prefix("network"), id); diff --git a/config.cpp b/config.cpp index 0257df9..b49c8d4 100644 --- a/config.cpp +++ b/config.cpp @@ -72,8 +72,8 @@ bool account_read_cb(weechat::config_section& section, if (!account->reloading_from_config) { - bool ac_global = std::stoul(std::unique_ptr( - weechat_info_get("auto_connect", NULL)).get()); + bool ac_global = std::stoul(std::unique_ptr( + weechat_info_get("auto_connect", NULL), &free).get()); bool ac_local = account->autoconnect(); if (ac_local && ac_global) account->connect(); diff --git a/config.hh b/config.hh index 04c8882..793c749 100644 --- a/config.hh +++ b/config.hh @@ -172,7 +172,7 @@ namespace weechat std::unordered_map options; }; - struct config_option_free { void operator() (struct t_config_option *ptr) { weechat_config_option_free(ptr); } }; + struct config_option_free { void operator() (struct t_config_option *ptr) { /* weechat_config_option_free(ptr); */ } }; struct config_option : public std::unique_ptr, public config_breadcrumb { config_option(struct t_config_option *ptr, config_section& section, std::string name) : std::unique_ptr(ptr)