1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

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.
This commit is contained in:
Tom Lane
2002-12-17 01:18:35 +00:00
parent 9f76d0d926
commit e932a724a4
6 changed files with 51 additions and 32 deletions

View File

@@ -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;
}