From 24142c94ca1fe2c350172e529d0ac9b4001e9307 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Fri, 28 Mar 2025 17:13:34 +0200 Subject: Avoiding malloc/free combo by providing a pointer to the function --- src/akfs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/akfs.c') 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; } -- cgit v1.2.3