Skip to content

Commit 00cf403

Browse files
committed
Fix minor memory leaks in psql's tab completion.
Tang Haiying and Tom Lane Discussion: https://postgr.es/m/OS0PR01MB6113EA19F05E217C823B4CCAFB909@OS0PR01MB6113.jpnprd01.prod.outlook.com
1 parent 202b56b commit 00cf403

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/bin/psql/tab-complete.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5159,6 +5159,10 @@ _complete_from_query(const char *simple_query,
51595159

51605160
/* Clean up */
51615161
termPQExpBuffer(&query_buffer);
5162+
if (schemaname)
5163+
free(schemaname);
5164+
if (objectname)
5165+
free(objectname);
51625166
free(e_object_like);
51635167
if (e_schemaname)
51645168
free(e_schemaname);

src/fe_utils/string_utils.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,4 +1227,7 @@ patternToSQLRegex(int encoding, PQExpBuffer dbnamebuf, PQExpBuffer schemabuf,
12271227
appendPQExpBufferStr(dbnamebuf, curbuf->data);
12281228
termPQExpBuffer(curbuf);
12291229
}
1230+
1231+
if (want_literal_dbname)
1232+
termPQExpBuffer(&left_literal);
12301233
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy