diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-12-17 01:18:35 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-12-17 01:18:35 +0000 |
| commit | e932a724a4a372c7db21ce7bf40250576b085041 (patch) | |
| tree | 02e45ca5656b4838336b1b2b6e9e31cea2f721dc /src/backend/nodes/list.c | |
| parent | 9f76d0d926ffe72e32248b7c79f585c47e643981 (diff) | |
To suppress memory leakage in long-lived Lists, lremove() should pfree
the cons cell it's deleting from the list. Do this, and fix a few callers
that were bogusly assuming it wouldn't free the cons cell.
Diffstat (limited to 'src/backend/nodes/list.c')
| -rw-r--r-- | src/backend/nodes/list.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/nodes/list.c b/src/backend/nodes/list.c index 6dc6001a0f2..b3c6a18496f 100644 --- a/src/backend/nodes/list.c +++ b/src/backend/nodes/list.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.42 2002/11/24 21:52:13 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.43 2002/12/17 01:18:18 tgl Exp $ * * NOTES * XXX a few of the following functions are duplicated to handle @@ -269,7 +269,6 @@ llasti(List *l) * Free the List nodes of a list * The pointed-to nodes, if any, are NOT freed. * This works for integer lists too. - * */ void freeList(List *list) @@ -487,6 +486,7 @@ lremove(void *elem, List *list) result = lnext(l); else lnext(prev) = lnext(l); + pfree(l); } return result; } @@ -518,6 +518,7 @@ LispRemove(void *elem, List *list) result = lnext(l); else lnext(prev) = lnext(l); + pfree(l); } return result; } @@ -545,6 +546,7 @@ lremovei(int elem, List *list) result = lnext(l); else lnext(prev) = lnext(l); + pfree(l); } return result; } |
