From 2be507bfb199e8c80e4b2ee1cb2c867b57fc1f6e Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 8 Jul 2016 14:24:54 +0200 Subject: Use fz_keep_imp and fz_drop_imp for all reference counting. --- source/pdf/pdf-pkcs7.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'source/pdf/pdf-pkcs7.c') diff --git a/source/pdf/pdf-pkcs7.c b/source/pdf/pdf-pkcs7.c index aaa18300..64938fb3 100644 --- a/source/pdf/pdf-pkcs7.c +++ b/source/pdf/pdf-pkcs7.c @@ -507,21 +507,16 @@ pdf_signer *pdf_read_pfx(fz_context *ctx, const char *pfile, const char *pw) pdf_signer *pdf_keep_signer(fz_context *ctx, pdf_signer *signer) { - if (signer) - signer->refs++; - return signer; + return fz_keep_imp(ctx, signer, &signer->refs); } void pdf_drop_signer(fz_context *ctx, pdf_signer *signer) { - if (signer) + if (fz_drop_imp(ctx, signer, &signer->refs)) { - if (--signer->refs == 0) - { - X509_free(signer->x509); - EVP_PKEY_free(signer->pkey); - fz_free(ctx, signer); - } + X509_free(signer->x509); + EVP_PKEY_free(signer->pkey); + fz_free(ctx, signer); } } -- cgit v1.2.3