diff --git a/src/log.c b/src/log.c index e4c7f305..e4e6e809 100644 --- a/src/log.c +++ b/src/log.c @@ -380,7 +380,11 @@ _chat_log_chat(const char * const login, const char * const other, g_hash_table_replace(logs, strdup(other), dated_log); } - if (timestamp == NULL) timestamp = g_date_time_new_now_local(); + if (timestamp == NULL) { + timestamp = g_date_time_new_now_local(); + } else { + g_date_time_ref(timestamp); + } gchar *date_fmt = g_date_time_format(timestamp, "%H:%M:%S"); FILE *logp = fopen(dated_log->filename, "a"); @@ -407,6 +411,7 @@ _chat_log_chat(const char * const login, const char * const other, } g_free(date_fmt); + g_date_time_unref(timestamp); } void diff --git a/src/pgp/gpg.c b/src/pgp/gpg.c index 80aba996..1ca184d0 100644 --- a/src/pgp/gpg.c +++ b/src/pgp/gpg.c @@ -317,6 +317,8 @@ p_gpg_verify(const char * const barejid, const char *const sign) gpgme_data_release(sign_data); gpgme_data_release(plain_data); + gpgme_release(ctx); + free(sign_with_header_footer); } char* diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index db817e13..496e9caa 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -892,6 +892,8 @@ _version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, log_warning("From attribute specified different JID, using original JID."); } + xmpp_ctx_t *ctx = xmpp_conn_get_context(conn); + Jid *jidp = jid_create((char*)userdata); const char *presence = NULL; if (muc_active(jidp->barejid)) { @@ -902,6 +904,9 @@ _version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, Resource *resource = p_contact_get_resource(contact, jidp->resourcepart); if (!resource) { ui_handle_software_version_error(jidp->fulljid, "Unknown resource"); + if (name_str) xmpp_free(ctx, name_str); + if (version_str) xmpp_free(ctx, version_str); + if (os_str) xmpp_free(ctx, os_str); return 0; } presence = string_from_resource_presence(resource->presence); @@ -912,6 +917,10 @@ _version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, jid_destroy(jidp); free(userdata); + if (name_str) xmpp_free(ctx, name_str); + if (version_str) xmpp_free(ctx, version_str); + if (os_str) xmpp_free(ctx, os_str); + return 0; }