Skip to content

Commit 4b85a7c

Browse files
author
Maxim Orlov
committed
Issue #27: Fix list remove generic algo.
1 parent 20f4ef3 commit 4b85a7c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pg_variables.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ HtabToStat_remove_if(List **l, void *value,
226226
/*
227227
* See https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=1cff1b95ab6ddae32faa3efe0d95a820dbfdc164
228228
*
229-
* Version > 13 have different lists interface.
229+
* Version >= 13 have different lists interface.
230230
*/
231231
ListCell *cell;
232232
HtabToStat *entry = NULL;
@@ -236,7 +236,14 @@ HtabToStat_remove_if(List **l, void *value,
236236
entry = (HtabToStat *) lfirst(cell);
237237

238238
if (eq(entry, value))
239+
{
239240
*l = foreach_delete_current(*l, cell);
241+
pfree(entry->status);
242+
pfree(entry);
243+
244+
if (match_first)
245+
return;
246+
}
240247
}
241248
#endif
242249
}

0 commit comments

Comments
 (0)