From 5500c89c187e4c864730163be522edf4ae3e96b8 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 9 Jan 2008 23:43:54 +0000 Subject: [PATCH] Remove incorrect (and ill-advised anyway) pfree's in pg_convert_from and pg_convert_to. Per bug #3866 from Andrew Gilligan. --- src/backend/utils/mb/mbutils.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/backend/utils/mb/mbutils.c b/src/backend/utils/mb/mbutils.c index 504aa80b4e..a674ae58ea 100644 --- a/src/backend/utils/mb/mbutils.c +++ b/src/backend/utils/mb/mbutils.c @@ -301,8 +301,8 @@ pg_convert_to(PG_FUNCTION_ARGS) { Datum string = PG_GETARG_DATUM(0); Datum dest_encoding_name = PG_GETARG_DATUM(1); - Datum src_encoding_name = DirectFunctionCall1( - namein, CStringGetDatum(DatabaseEncoding->name)); + Datum src_encoding_name = DirectFunctionCall1(namein, + CStringGetDatum(DatabaseEncoding->name)); Datum result; /* @@ -310,11 +310,8 @@ pg_convert_to(PG_FUNCTION_ARGS) * text argument here, relying on the fact that they are both in fact * varlena types, and thus structurally identical. */ - result = DirectFunctionCall3( - pg_convert, string, src_encoding_name, dest_encoding_name); - - /* free memory allocated by namein */ - pfree((void *) src_encoding_name); + result = DirectFunctionCall3(pg_convert, string, + src_encoding_name, dest_encoding_name); PG_RETURN_BYTEA_P(result); } @@ -329,15 +326,12 @@ pg_convert_from(PG_FUNCTION_ARGS) { Datum string = PG_GETARG_DATUM(0); Datum src_encoding_name = PG_GETARG_DATUM(1); - Datum dest_encoding_name = DirectFunctionCall1( - namein, CStringGetDatum(DatabaseEncoding->name)); + Datum dest_encoding_name = DirectFunctionCall1(namein, + CStringGetDatum(DatabaseEncoding->name)); Datum result; - result = DirectFunctionCall3( - pg_convert, string, src_encoding_name, dest_encoding_name); - - /* free memory allocated by namein */ - pfree((void *) src_encoding_name); + result = DirectFunctionCall3(pg_convert, string, + src_encoding_name, dest_encoding_name); /* * pg_convert returns a bytea, which we in turn return as text, relying on -- 2.39.5