Skip to content

Commit 5ac1eac

Browse files
committed
Suppress memory leak in COPY WITH OIDS TO wherever.
1 parent 13612a9 commit 5ac1eac

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/backend/commands/copy.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.115 2000/06/17 21:48:42 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.116 2000/06/28 06:05:36 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -475,10 +475,11 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim, char *null_p
475475

476476
if (oids && !binary)
477477
{
478-
CopySendString(DatumGetCString(DirectFunctionCall1(oidout,
479-
ObjectIdGetDatum(tuple->t_data->t_oid))),
480-
fp);
478+
string = DatumGetCString(DirectFunctionCall1(oidout,
479+
ObjectIdGetDatum(tuple->t_data->t_oid)));
480+
CopySendString(string, fp);
481481
CopySendChar(delim[0], fp);
482+
pfree(string);
482483
}
483484

484485
for (i = 0; i < attr_count; i++)

0 commit comments

Comments
 (0)