Index: pgsql/contrib/pgcrypto/internal.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/contrib/pgcrypto/internal.c,v retrieving revision 1.1 diff -u -r1.1 internal.c --- pgsql/contrib/pgcrypto/internal.c 2000/10/31 13:11:28 1.1 +++ pgsql/contrib/pgcrypto/internal.c 2000/10/31 14:06:29 @@ -60,9 +60,9 @@ static pg_digest int_digest_list [] = { - { "md5", pg_md5_len, pg_md5_digest, {0}}, - { "sha1", pg_sha1_len, pg_sha1_digest, {0}}, - { NULL, NULL, NULL, {0}} + { "md5", pg_md5_len, pg_md5_digest, NULL, {0}}, + { "sha1", pg_sha1_len, pg_sha1_digest, NULL, {0}}, + { NULL, NULL, NULL, NULL, {0}} }; static uint Index: pgsql/contrib/pgcrypto/krb.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/contrib/pgcrypto/krb.c,v retrieving revision 1.1 diff -u -r1.1 krb.c --- pgsql/contrib/pgcrypto/krb.c 2000/10/31 13:11:28 1.1 +++ pgsql/contrib/pgcrypto/krb.c 2000/10/31 14:06:29 @@ -65,9 +65,9 @@ static pg_digest int_digest_list [] = { - { "md5", pg_md5_len, pg_md5_digest, {0}}, - { "sha1", pg_sha1_len, pg_sha1_digest, {0}}, - { NULL, NULL, NULL, {0}} + { "md5", pg_md5_len, pg_md5_digest, NULL, {0}}, + { "sha1", pg_sha1_len, pg_sha1_digest, NULL, {0}}, + { NULL, NULL, NULL, NULL, {0}} }; static uint Index: pgsql/contrib/pgcrypto/mhash.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/contrib/pgcrypto/mhash.c,v retrieving revision 1.1 diff -u -r1.1 mhash.c --- pgsql/contrib/pgcrypto/mhash.c 2000/10/31 13:11:28 1.1 +++ pgsql/contrib/pgcrypto/mhash.c 2000/10/31 14:06:29 @@ -54,10 +54,13 @@ mhash(mh, src, len); res = mhash_end(mh); - memcpy(dst, res, mhash_get_block_size(h->misc.code)); - mhash_free(res); - - return dst; + return res; +} + +static void +pg_mhash_free(uint8 *result) +{ + mhash_free(result); } pg_digest * @@ -77,6 +80,7 @@ h->name = mhash_get_hash_name(i); h->length = pg_mhash_len; h->digest = pg_mhash_digest; + h->free = pg_mhash_free; h->misc.code = i; return h; } Index: pgsql/contrib/pgcrypto/openssl.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/contrib/pgcrypto/openssl.c,v retrieving revision 1.1 diff -u -r1.1 openssl.c --- pgsql/contrib/pgcrypto/openssl.c 2000/10/31 13:11:28 1.1 +++ pgsql/contrib/pgcrypto/openssl.c 2000/10/31 14:06:29 @@ -76,6 +76,7 @@ h->name = name; h->length = pg_ossl_len; h->digest = pg_ossl_digest; + h->free = NULL; h->misc.ptr = (void*)md; return h; Index: pgsql/contrib/pgcrypto/pgcrypto.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/contrib/pgcrypto/pgcrypto.c,v retrieving revision 1.1 diff -u -r1.1 pgcrypto.c --- pgsql/contrib/pgcrypto/pgcrypto.c 2000/10/31 13:11:28 1.1 +++ pgsql/contrib/pgcrypto/pgcrypto.c 2000/10/31 14:06:29 @@ -88,8 +88,11 @@ p = h->digest(h, VARDATA(arg), len, buf); to_hex(p, hlen, VARDATA(res)); + if (h->free != NULL) + h->free(p); + PG_FREE_IF_COPY(arg, 0); - PG_FREE_IF_COPY(name, 0); // unnecessary i guess + PG_FREE_IF_COPY(name, 0); /* unnecessary i guess */ PG_RETURN_TEXT_P(res); } @@ -108,7 +111,7 @@ res = find_digest(&_hbuf, name, 1); - PG_FREE_IF_COPY(name, 0); // unnecessary i guess + PG_FREE_IF_COPY(name, 0); /* unnecessary i guess */ if (res != NULL) PG_RETURN_BOOL(true); Index: pgsql/contrib/pgcrypto/pgcrypto.h =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/contrib/pgcrypto/pgcrypto.h,v retrieving revision 1.1 diff -u -r1.1 pgcrypto.h --- pgsql/contrib/pgcrypto/pgcrypto.h 2000/10/31 13:11:28 1.1 +++ pgsql/contrib/pgcrypto/pgcrypto.h 2000/10/31 14:06:29 @@ -40,6 +40,7 @@ uint (*length)(pg_digest *h); uint8 *(*digest)(pg_digest *h, uint8 *data, uint dlen, uint8 *buf); + void (*free)(uint8 *buf); /* private */ union { uint code;