Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3026493

Browse files
committed
This patch fixes two tiny memory leaks in pg_dump and two in pg_dumpall.
Neil Conway
1 parentcf4e603 commit3026493

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*by PostgreSQL
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.308 2002/11/23 03:59:08 momjian Exp $
15+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.309 2002/11/29 16:38:42 momjian Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -3226,6 +3226,7 @@ dumpOneDomain(Archive *fout, TypeInfo *tinfo)
32263226
"WHERE contypid = '%s'::pg_catalog.oid",
32273227
tinfo->oid);
32283228

3229+
PQclear(res);
32293230
res=PQexec(g_conn,chkquery->data);
32303231
if (!res||
32313232
PQresultStatus(res)!=PGRES_TUPLES_OK)
@@ -3269,6 +3270,7 @@ dumpOneDomain(Archive *fout, TypeInfo *tinfo)
32693270
destroyPQExpBuffer(q);
32703271
destroyPQExpBuffer(delq);
32713272
destroyPQExpBuffer(query);
3273+
destroyPQExpBuffer(chkquery);
32723274
}
32733275

32743276
/*

‎src/bin/pg_dump/pg_dumpall.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
88
*
9-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.10 2002/11/22 03:09:43 tgl Exp $
9+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.11 2002/11/29 16:38:42 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -403,7 +403,7 @@ dumpCreateDB(PGconn *conn)
403403

404404
for (i=0;i<PQntuples(res);i++)
405405
{
406-
PQExpBufferbuf=createPQExpBuffer();
406+
PQExpBufferbuf;
407407
char*dbname=PQgetvalue(res,i,0);
408408
char*dbowner=PQgetvalue(res,i,1);
409409
char*dbencoding=PQgetvalue(res,i,2);
@@ -413,6 +413,8 @@ dumpCreateDB(PGconn *conn)
413413
if (strcmp(dbname,"template1")==0)
414414
continue;
415415

416+
buf=createPQExpBuffer();
417+
416418
if (output_clean)
417419
appendPQExpBuffer(buf,"DROP DATABASE %s\n;",fmtId(dbname));
418420

@@ -692,6 +694,7 @@ connectDatabase(const char *dbname, const char *pghost, const char *pgport,
692694
exit(1);
693695
}
694696
}
697+
PQclear(res);
695698

696699
returnconn;
697700
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp