From f8d5aa58f9af512f5f04a5fe4dce479709be32ba Mon Sep 17 00:00:00 2001 From: Fredrik Gustafsson Date: Mon, 11 Nov 2019 19:02:04 +0100 Subject: Make tests pass and introduce a memory leak Since 37fbafcd928c466c82c892a7868d686d710e5d07 the tests hasn't worked since a string on the stack was added as version for a virtual package. Instead create the version string on the heap and then simply leak it. A short running program as apk shouldn't need to worry about memory leaks. --- src/add.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add.c b/src/add.c index e028736..1fe2c7a 100644 --- a/src/add.c +++ b/src/add.c @@ -97,7 +97,7 @@ static struct apk_package *create_virtual_package(struct apk_database *db, struc if (virtpkg == NULL) return 0; virtpkg->name = name; - virtpkg->version = apk_blob_atomize(APK_BLOB_STR(ver)); + virtpkg->version = apk_blob_atomize_dup(APK_BLOB_STR(ver)); virtpkg->description = strdup("virtual meta package"); virtpkg->arch = apk_blob_atomize(APK_BLOB_STR("noarch")); -- cgit v1.2.3