commit 59f21e74fc3df78f52752534643c1fe4f83ecb21
parent a8c86b39d8bfe3178c65a50eda42320f195e86be
Author: sin <sin@2f30.org>
Date: Thu, 3 Jul 2014 14:22:56 +0100
Remove entries when destroying lists
Diffstat:
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/db.c b/db.c
@@ -50,11 +50,13 @@ db_free(struct db *db)
for (pkg = TAILQ_FIRST(&db->pkg_head); pkg; pkg = tmp) {
tmp = TAILQ_NEXT(pkg, entry);
+ TAILQ_REMOVE(&db->pkg_head, pkg, entry);
pkg_free(pkg);
}
for (pkg = TAILQ_FIRST(&db->pkg_rm_head); pkg; pkg = tmp) {
tmp = TAILQ_NEXT(pkg, entry);
+ TAILQ_REMOVE(&db->pkg_rm_head, pkg, entry);
pkg_free(pkg);
}
diff --git a/pkg.c b/pkg.c
@@ -320,6 +320,7 @@ pkg_free(struct pkg *pkg)
for (pe = TAILQ_FIRST(&pkg->pe_head); pe; pe = tmp) {
tmp = TAILQ_NEXT(pe, entry);
+ TAILQ_REMOVE(&pkg->pe_head, pe, entry);
pkgentry_free(pe);
}
free(pkg->name);