Skip to content

Commit 90474c1

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 7d158e8 commit 90474c1

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/bin/psql/tab-complete.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5158,6 +5158,8 @@ _complete_from_query(const char *simple_query,
51585158

51595159
/* Clean up */
51605160
termPQExpBuffer(&query_buffer);
5161+
free(schemaname);
5162+
free(objectname);
51615163
free(e_object_like);
51625164
free(e_schemaname);
51635165
free(e_ref_object);

src/fe_utils/string_utils.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,4 +1225,7 @@ patternToSQLRegex(int encoding, PQExpBuffer dbnamebuf, PQExpBuffer schemabuf,
12251225
appendPQExpBufferStr(dbnamebuf, curbuf->data);
12261226
termPQExpBuffer(curbuf);
12271227
}
1228+
1229+
if (want_literal_dbname)
1230+
termPQExpBuffer(&left_literal);
12281231
}

0 commit comments

Comments
 (0)