From 05f016481abd851e295f26ad3cb1174a21e93d24 Mon Sep 17 00:00:00 2001 From: Timo Teras Date: Wed, 12 Aug 2009 19:29:14 +0300 Subject: db: fix some (unimportant) memory leaks --- src/database.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/database.c b/src/database.c index 79e9cb3..dfaf343 100644 --- a/src/database.c +++ b/src/database.c @@ -63,7 +63,10 @@ static apk_blob_t pkg_name_get_key(apk_hash_item item) static void pkg_name_free(struct apk_name *name) { free(name->name); - free(name->pkgs); + if (name->pkgs) + free(name->pkgs); + if (name->rdepends) + free(name->rdepends); free(name); } @@ -408,6 +411,11 @@ struct apk_package *apk_db_pkg_add(struct apk_database *db, struct apk_package * idb->filename = pkg->filename; pkg->filename = NULL; } + if (idb->ipkg == NULL && pkg->ipkg != NULL) { + idb->ipkg = pkg->ipkg; + idb->ipkg->pkg = idb; + pkg->ipkg = NULL; + } apk_pkg_free(pkg); } return idb; -- cgit v1.2.3-70-g09d2