1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-21 16:02:15 +03:00

Repair erroneous use of hashvarlena() for MACADDR, which is not a

varlena type.  (I did not force initdb, but you won't see the fix
unless you do one.)  Also, make sure all index support operators and
functions are careful not to leak memory for toasted inputs; I had
missed some hash and rtree support ops on this point before.
This commit is contained in:
Tom Lane
2000-12-08 23:57:03 +00:00
parent fb47385fc8
commit 376784cf8a
8 changed files with 116 additions and 31 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.71 2000/11/26 11:35:23 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.72 2000/12/08 23:57:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -663,11 +663,17 @@ hashbpchar(PG_FUNCTION_ARGS)
BpChar *key = PG_GETARG_BPCHAR_P(0);
char *keydata;
int keylen;
Datum result;
keydata = VARDATA(key);
keylen = bcTruelen(key);
return hash_any(keydata, keylen);
result = hash_any(keydata, keylen);
/* Avoid leaking memory for toasted inputs */
PG_FREE_IF_COPY(key, 0);
return result;
}