mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
Fix memory leak in SetClientEncoding().
This commit is contained in:
parent
fcbc87c1ee
commit
538b101595
@ -3,7 +3,7 @@
|
|||||||
* client encoding and server internal encoding.
|
* client encoding and server internal encoding.
|
||||||
* (currently mule internal code (mic) is used)
|
* (currently mule internal code (mic) is used)
|
||||||
* Tatsuo Ishii
|
* Tatsuo Ishii
|
||||||
* $Id: mbutils.c,v 1.30 2002/08/08 06:35:26 ishii Exp $
|
* $Id: mbutils.c,v 1.31 2002/08/14 05:33:34 ishii Exp $
|
||||||
*/
|
*/
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
#include "access/xact.h"
|
#include "access/xact.h"
|
||||||
@ -90,7 +90,21 @@ SetClientEncoding(int encoding, bool doit)
|
|||||||
if (IsTransactionState())
|
if (IsTransactionState())
|
||||||
{
|
{
|
||||||
ClientEncoding = &pg_enc2name_tbl[encoding];
|
ClientEncoding = &pg_enc2name_tbl[encoding];
|
||||||
|
|
||||||
|
if(ToServerConvPorc != NULL)
|
||||||
|
{
|
||||||
|
if (ToServerConvPorc->fn_extra)
|
||||||
|
pfree(ToServerConvPorc->fn_extra);
|
||||||
|
pfree(ToServerConvPorc);
|
||||||
|
}
|
||||||
ToServerConvPorc = to_server;
|
ToServerConvPorc = to_server;
|
||||||
|
|
||||||
|
if(ToClientConvPorc != NULL)
|
||||||
|
{
|
||||||
|
if (ToClientConvPorc->fn_extra)
|
||||||
|
pfree(ToClientConvPorc->fn_extra);
|
||||||
|
pfree(ToClientConvPorc);
|
||||||
|
}
|
||||||
ToClientConvPorc = to_client;
|
ToClientConvPorc = to_client;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user