[PATCH 04/20] util/crypto: _notmuch_message_crypto: tracks message-wide crypto state

David Bremner david at tethera.net
Fri Jun 15 03:16:05 PDT 2018

Daniel Kahn Gillmor <dkg at fifthhorseman.net> writes:

> +notmuch_status_t
> +_notmuch_message_crypto_set_sig_list (_notmuch_message_crypto_t *msg_crypto, GMimeSignatureList *sigs)
> +{

It's a bit confusing that nothing in this API/patch seems to use the
sig_list stored by this function

> +void
> +_notmuch_message_crypto_cleanup (_notmuch_message_crypto_t *msg_crypto)
> +{
> +    if (!msg_crypto)
> +	return;
> +    if (msg_crypto->sig_list)
> +	g_object_unref (msg_crypto->sig_list);
> +}

It _looks_ like you're planning on manually calling
_notmuch_message_crypto_cleanup.  In order to allow for hierarchical
de-allocation (i.e. non-explicit de-allocation, we need to call
talloc_set_destructor. There's a few examples in the the existing code.

More information about the notmuch mailing list