Hi,

Here is a patch fixing the subject.

Regards,

-- 
Sergey Shinderuk                https://postgrespro.com/
diff --git a/src/common/hmac.c b/src/common/hmac.c
index 1089db67443..bfe2e7cb5e9 100644
--- a/src/common/hmac.c
+++ b/src/common/hmac.c
@@ -232,7 +232,10 @@ pg_hmac_final(pg_hmac_ctx *ctx, uint8 *dest, size_t len)
        memset(h, 0, ctx->digest_size);
 
        if (pg_cryptohash_final(ctx->hash, h, ctx->digest_size) < 0)
+       {
+               FREE(h);
                return -1;
+       }
 
        /* H(K XOR opad, tmp) */
        if (pg_cryptohash_init(ctx->hash) < 0 ||
@@ -240,9 +243,11 @@ pg_hmac_final(pg_hmac_ctx *ctx, uint8 *dest, size_t len)
                pg_cryptohash_update(ctx->hash, h, ctx->digest_size) < 0 ||
                pg_cryptohash_final(ctx->hash, dest, len) < 0)
        {
+               FREE(h);
                return -1;
        }
 
+       FREE(h);
        return 0;
 }
 

Reply via email to