struct fuzzy_key_stat *stat;
khash_t(fuzzy_key_flag_stat) * flags_stat;
khash_t(fuzzy_key_ids_set) * forbidden_ids;
+ ref_entry_t ref;
};
KHASH_INIT(rspamd_fuzzy_keys_hash,
{
struct fuzzy_key *key;
kh_foreach_value(hash, key, {
- fuzzy_key_dtor(key);
+ REF_RELEASE(key);
});
kh_destroy(rspamd_fuzzy_keys_hash, hash);
}
key = kh_val(s->ctx->keys, k);
}
- s->key = key;
-
/* Now process the remote pubkey */
rk = rspamd_pubkey_from_bin(hdr.pubkey, sizeof(hdr.pubkey),
RSPAMD_KEYPAIR_KEX, RSPAMD_CRYPTOBOX_MODE_25519);
return FALSE;
}
+ s->key = key;
+ REF_RETAIN(key);
+
memcpy(s->nm, rspamd_pubkey_get_nm(rk, key->key), sizeof(s->nm));
rspamd_pubkey_unref(rk);
g_free(session->extensions);
}
+ if (session->key) {
+ REF_RELEASE(session->key);
+ }
+
g_free(session);
}
}
key = g_malloc0(sizeof(*key));
+ REF_INIT_RETAIN(key, fuzzy_key_dtor);
key->key = kp;
keystat = g_malloc0(sizeof(*keystat));
REF_INIT_RETAIN(keystat, fuzzy_key_stat_dtor);
if (r == 0) {
msg_err("duplicate keypair found: pk=%*bs",
32, pk);
- fuzzy_key_dtor(key);
+ REF_RELEASE(key);
return FALSE;
}
else if (r == -1) {
msg_err("hash insertion error: pk=%*bs",
32, pk);
- fuzzy_key_dtor(key);
+ REF_RELEASE(key);
return FALSE;
}