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

Appearance settings

Commit 623644f

Browse filesBrowse files
committed
Plug memory leak in index_get_partition
The list of indexes was being leaked when asked for an index that doesn't have an index partition in the table partition. Not a common case admittedly --and in most cases where it occurs, caller throws an error anyway-- but worth fixing for cleanliness and in case any third-party code is calling this function. While at it, remove use of lfirst_oid() to obtain a value we already have. Author: Justin Pryzby <pryzby@telsasoft.com> Reviewed-by: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/20201105203606.GF22691@telsasoft.com
1 parent a05dbf4 commit 623644f
Copy full SHA for 623644f

File tree

Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed

‎src/backend/catalog/partition.c

Copy file name to clipboardExpand all lines: src/backend/catalog/partition.c
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,14 @@ index_get_partition(Relation partition, Oid indexId)
170170
ReleaseSysCache(tup);
171171
if (!ispartition)
172172
continue;
173-
if (get_partition_parent(lfirst_oid(l)) == indexId)
173+
if (get_partition_parent(partIdx) == indexId)
174174
{
175175
list_free(idxlist);
176176
return partIdx;
177177
}
178178
}
179179

180+
list_free(idxlist);
180181
return InvalidOid;
181182
}
182183

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.