Fix memory leakage introduced into print_aligned_text by 8.4 changes
(failure to free col_lineptrs[] array elements) and exacerbated in the current devel cycle (failure to free "wrap"). This resulted in moderate bloat of psql over long script runs. Noted while testing bug #5302, although what the reporter was complaining of was backend-side leakage.
This commit is contained in:
parent
3e51ae491d
commit
07be293a97
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
|
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.120 2010/01/02 16:57:59 momjian Exp $
|
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.121 2010/01/30 18:59:51 tgl Exp $
|
||||||
*/
|
*/
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
|
|
||||||
@ -1047,6 +1047,11 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
|
for (i = 0; i < col_count; i++)
|
||||||
|
{
|
||||||
|
free(col_lineptrs[i]);
|
||||||
|
free(format_buf[i]);
|
||||||
|
}
|
||||||
free(width_header);
|
free(width_header);
|
||||||
free(width_average);
|
free(width_average);
|
||||||
free(max_width);
|
free(max_width);
|
||||||
@ -1055,11 +1060,10 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
|
|||||||
free(curr_nl_line);
|
free(curr_nl_line);
|
||||||
free(col_lineptrs);
|
free(col_lineptrs);
|
||||||
free(max_bytes);
|
free(max_bytes);
|
||||||
|
free(format_buf);
|
||||||
free(header_done);
|
free(header_done);
|
||||||
free(bytes_output);
|
free(bytes_output);
|
||||||
for (i = 0; i < col_count; i++)
|
free(wrap);
|
||||||
free(format_buf[i]);
|
|
||||||
free(format_buf);
|
|
||||||
|
|
||||||
if (is_pager)
|
if (is_pager)
|
||||||
ClosePager(fout);
|
ClosePager(fout);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user