Fix memory leak in plperl_hash_from_tuple(), per report from Jean-Max Reymond.

This commit is contained in:
Tom Lane 2005-07-03 21:56:16 +00:00
parent ae9a07bf9e
commit bee9aef43b
1 changed files with 6 additions and 4 deletions

View File

@ -33,7 +33,7 @@
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.78 2005/06/22 16:45:51 tgl Exp $
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.79 2005/07/03 21:56:16 tgl Exp $
*
**********************************************************************/
@ -1327,14 +1327,16 @@ plperl_hash_from_tuple(HeapTuple tuple, TupleDesc tupdesc)
getTypeOutputInfo(tupdesc->attrs[i]->atttypid,
&typoutput, &typisvarlena);
outputstr = DatumGetCString(OidFunctionCall1(typoutput,
attr));
outputstr = DatumGetCString(OidFunctionCall1(typoutput, attr));
sv = newSVpv(outputstr, 0);
#if PERL_BCDVERSION >= 0x5006000L
if (GetDatabaseEncoding() == PG_UTF8) SvUTF8_on(sv);
if (GetDatabaseEncoding() == PG_UTF8)
SvUTF8_on(sv);
#endif
hv_store(hv, attname, namelen, sv, 0);
pfree(outputstr);
}
return newRV_noinc((SV *) hv);