1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +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/access/hash/hashfunc.c,v 1.27 2000/06/19 03:54:17 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.28 2000/12/08 23:57:02 tgl Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@@ -106,8 +106,14 @@ Datum
hashvarlena(PG_FUNCTION_ARGS)
{
struct varlena *key = PG_GETARG_VARLENA_P(0);
Datum result;
return hash_any(VARDATA(key), VARSIZE(key) - VARHDRSZ);
result = hash_any(VARDATA(key), VARSIZE(key) - VARHDRSZ);
/* Avoid leaking memory for toasted inputs */
PG_FREE_IF_COPY(key, 0);
return result;
}

View File

@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.29 2000/07/30 20:43:40 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.30 2000/12/08 23:57:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -183,5 +183,8 @@ rt_poly_size(PG_FUNCTION_ARGS)
*size = (float) (xdim * ydim);
}
/* Avoid leaking memory when handed toasted input. */
PG_FREE_IF_COPY(a, 0);
PG_RETURN_VOID();
}