summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/lst.lib/lstDestroy.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/make/lst.lib/lstDestroy.c')
-rw-r--r--usr.bin/make/lst.lib/lstDestroy.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/usr.bin/make/lst.lib/lstDestroy.c b/usr.bin/make/lst.lib/lstDestroy.c
index 15bac2d..39d5239 100644
--- a/usr.bin/make/lst.lib/lstDestroy.c
+++ b/usr.bin/make/lst.lib/lstDestroy.c
@@ -69,18 +69,9 @@ Lst_Destroy(Lst *list, FreeProc *freeProc)
{
LstNode *ln;
- if (!Lst_Valid(list)) {
- /*
- * Note the check to catch uninitialized static Lst's.
- * Gross, but useful.
- */
+ if (list->firstPtr == NULL)
return;
- }
- if (list->firstPtr == NULL) {
- free(list);
- return;
- }
if (freeProc != NOFREE) {
while ((ln = list->firstPtr) != NULL) {
list->firstPtr = ln->nextPtr;
@@ -90,9 +81,8 @@ Lst_Destroy(Lst *list, FreeProc *freeProc)
} else {
while ((ln = list->firstPtr) != NULL) {
list->firstPtr = ln->nextPtr;
- free(ln);
+ free(ln);
}
}
-
- free(list);
+ list->lastPtr = NULL;
}
OpenPOWER on IntegriCloud