aboutsummaryrefslogtreecommitdiff
path: root/src/akfs.c
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2025-03-28 17:13:34 +0200
committerkaotisk <kaotisk@arching-kaos.org>2025-03-28 17:13:34 +0200
commit24142c94ca1fe2c350172e529d0ac9b4001e9307 (patch)
treee9b438be202f3f99b494b9a153cdb9cec181bece /src/akfs.c
parent50502ec2b41733ba5f152cbde457f6cb66e588c6 (diff)
downloadarching-kaos-tools-24142c94ca1fe2c350172e529d0ac9b4001e9307.tar.gz
arching-kaos-tools-24142c94ca1fe2c350172e529d0ac9b4001e9307.tar.bz2
arching-kaos-tools-24142c94ca1fe2c350172e529d0ac9b4001e9307.zip
Avoiding malloc/free combo by providing a pointer to the function
Diffstat (limited to 'src/akfs.c')
-rw-r--r--src/akfs.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/akfs.c b/src/akfs.c
index 6388a35..c79882a 100644
--- a/src/akfs.c
+++ b/src/akfs.c
@@ -258,9 +258,8 @@ sha512sum ak_fs_sha512sum_string_to_struct(char* string)
}
}
-char* ak_fs_sha512sum_struct_to_string(sha512sum hash)
+void ak_fs_sha512sum_struct_to_string(sha512sum hash, char* string)
{
- char *string = malloc(129);
int counter = 0;
for (size_t i = 0; i < 8; ++i)
{
@@ -324,5 +323,4 @@ char* ak_fs_sha512sum_struct_to_string(sha512sum hash)
}
}
string[128] = '\0';
- return string;
}