mirror of
https://github.com/postgres/postgres.git
synced 2025-08-28 18:48:04 +03:00
Revert the behavior of inet/cidr functions to not unpack the arguments.
I forgot to change the functions to use the PG_GETARG_INET_PP() macro, when I changed DatumGetInetP() to unpack the datum, like Datum*P macros usually do. Also, I screwed up the definition of the PG_GETARG_INET_PP() macro, and didn't notice because it wasn't used. This fixes the memory leak when sorting inet values, as reported by Jochen Erwied and debugged by Andres Freund. Backpatch to 8.3, like the previous patch that broke it.
This commit is contained in:
@@ -74,7 +74,7 @@ typedef struct macaddr
|
||||
#define DatumGetInetPP(X) ((inet *) PG_DETOAST_DATUM_PACKED(X))
|
||||
#define InetPGetDatum(X) PointerGetDatum(X)
|
||||
#define PG_GETARG_INET_P(n) DatumGetInetP(PG_GETARG_DATUM(n))
|
||||
#define PG_GETARG_INET_PP(n) DatumGetInetP(PG_GETARG_DATUM_PACKED(n))
|
||||
#define PG_GETARG_INET_PP(n) DatumGetInetPP(PG_GETARG_DATUM(n))
|
||||
#define PG_RETURN_INET_P(x) return InetPGetDatum(x)
|
||||
/* macaddr is a fixed-length pass-by-reference datatype */
|
||||
#define DatumGetMacaddrP(X) ((macaddr *) DatumGetPointer(X))
|
||||
|
Reference in New Issue
Block a user