summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Gustafsson <fredrigu@axis.com>2019-11-11 19:02:04 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2019-11-18 16:18:24 +0100
commitf8d5aa58f9af512f5f04a5fe4dce479709be32ba (patch)
tree1b069c88e9b2f223411a8aaaa29e4204bd779505
parentc635c046693cd08f2fcd8eaea218086cf231332c (diff)
downloadapk-tools-f8d5aa58f9af512f5f04a5fe4dce479709be32ba.tar.gz
apk-tools-f8d5aa58f9af512f5f04a5fe4dce479709be32ba.tar.bz2
apk-tools-f8d5aa58f9af512f5f04a5fe4dce479709be32ba.tar.xz
apk-tools-f8d5aa58f9af512f5f04a5fe4dce479709be32ba.zip
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.
-rw-r--r--src/add.c2
1 files changed, 1 insertions, 1 deletions
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"));