aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2005-05-18 05:01:10 +0000
committerNeil Conway <neilc@samurai.com>2005-05-18 05:01:10 +0000
commit6910032a56dd3841be137b4bef7c57ef32a60ac8 (patch)
tree5325445fb5e5405361f8a4191cce3257ad35e8e3 /src
parent4c1f9a0f0bb41c31b26bb88ba8c5d3fca4521dd7 (diff)
downloadpostgresql-6910032a56dd3841be137b4bef7c57ef32a60ac8.tar.gz
postgresql-6910032a56dd3841be137b4bef7c57ef32a60ac8.zip
Upon closer inspection, Greg's psql tab completion patch leaks memory.
Fix the leak, and add a comment to note that the return value of previous_word must be free'd.
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/tab-complete.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 015dbd47793..571d7b34cfd 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.128 2005/05/18 04:47:40 neilc Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.129 2005/05/18 05:01:10 neilc Exp $
*/
/*----------------------------------------------------------------------
@@ -1802,6 +1802,7 @@ psql_completion(char *text, int start, int end)
free(prev2_wd);
free(prev3_wd);
free(prev4_wd);
+ free(prev5_wd);
/* Return our Grand List O' Matches */
return matches;
@@ -2168,9 +2169,11 @@ exec_query(const char *query)
-/* Return the word (space delimited) before point. Set skip > 0 to skip that
- many words; e.g. skip=1 finds the word before the previous one.
-*/
+/*
+ * Return the word (space delimited) before point. Set skip > 0 to
+ * skip that many words; e.g. skip=1 finds the word before the
+ * previous one. Return value is NULL or a malloc'ed string.
+ */
static char *
previous_word(int point, int skip)
{