Allow crypto structs to be used with g_autoptr, avoiding the need to
explicitly call XXX_free() functions when variables go out of scope on
the stack.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
*/
void qcrypto_block_free(QCryptoBlock *block);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlock, qcrypto_block_free)
+
#endif /* QCRYPTO_BLOCK_H */
*/
void qcrypto_cipher_free(QCryptoCipher *cipher);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoCipher, qcrypto_cipher_free)
+
/**
* qcrypto_cipher_encrypt:
* @cipher: the cipher object
*/
void qcrypto_hmac_free(QCryptoHmac *hmac);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoHmac, qcrypto_hmac_free)
+
/**
* qcrypto_hmac_bytesv:
* @hmac: the hmac object
*/
void qcrypto_ivgen_free(QCryptoIVGen *ivgen);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoIVGen, qcrypto_ivgen_free)
+
#endif /* QCRYPTO_IVGEN_H */
*/
void qcrypto_tls_session_free(QCryptoTLSSession *sess);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoTLSSession, qcrypto_tls_session_free)
+
/**
* qcrypto_tls_session_check_credentials:
* @sess: the TLS session object