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

Commit07be293

Browse files
committed
Fix memory leakage introduced into print_aligned_text by 8.4 changes
(failure to free col_lineptrs[] array elements) and exacerbated in thecurrent devel cycle (failure to free "wrap"). This resulted in moderatebloat of psql over long script runs. Noted while testing bug #5302,although what the reporter was complaining of was backend-side leakage.
1 parent3e51ae4 commit07be293

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎src/bin/psql/print.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.120 2010/01/02 16:57:59 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.121 2010/01/30 18:59:51 tgl Exp $
77
*/
88
#include"postgres_fe.h"
99

@@ -1047,6 +1047,11 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
10471047
}
10481048

10491049
/* clean up */
1050+
for (i=0;i<col_count;i++)
1051+
{
1052+
free(col_lineptrs[i]);
1053+
free(format_buf[i]);
1054+
}
10501055
free(width_header);
10511056
free(width_average);
10521057
free(max_width);
@@ -1055,11 +1060,10 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
10551060
free(curr_nl_line);
10561061
free(col_lineptrs);
10571062
free(max_bytes);
1063+
free(format_buf);
10581064
free(header_done);
10591065
free(bytes_output);
1060-
for (i=0;i<col_count;i++)
1061-
free(format_buf[i]);
1062-
free(format_buf);
1066+
free(wrap);
10631067

10641068
if (is_pager)
10651069
ClosePager(fout);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp