it was using too soon. In a situation where pg_do_encoding_conversion is
a no-op, this led to garbage data returned.
In HEAD, also modify the code that's ensuring null termination to make it
a tad more obvious what's happening.
size - 1,
PG_UTF8,
GetDatabaseEncoding());
- BIO_free(membuf);
-
outlen = strlen(dp);
result = palloc(VARHDRSZ + outlen);
memcpy(VARDATA(result), dp, outlen);
SET_VARSIZE(result, VARHDRSZ + outlen);
- /*
- * pg_do_encoding_conversion has annoying habit of returning source
- * pointer
- */
if (dp != sp)
pfree(dp);
+ BIO_free(membuf);
PG_RETURN_TEXT_P(result);
}