From 8f64ff6e5ce8bd349819f8fd499fc741a2ac1926 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Tue, 29 Apr 2025 06:42:35 +0300 Subject: Reducing leaks --- c_implementation/src/ak_fs_map_v3.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'c_implementation/src/ak_fs_map_v3.c') diff --git a/c_implementation/src/ak_fs_map_v3.c b/c_implementation/src/ak_fs_map_v3.c index 6774f65..1d3e37e 100644 --- a/c_implementation/src/ak_fs_map_v3.c +++ b/c_implementation/src/ak_fs_map_v3.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -179,12 +180,14 @@ int ak_fs_map_v3_open_from_file(akfs_map_v3 * map) { // perror("fopen"); ak_log_debug(__func__, "File not found or other error"); + free(full_path); return 1; } struct stat sb; if (stat(full_path, &sb) == -1) { perror("stat"); fclose(fd); + free(full_path); return 2; } // File size: %lld in bytes: (long long) sb.st_size); @@ -195,9 +198,11 @@ int ak_fs_map_v3_open_from_file(akfs_map_v3 * map) { ak_log_debug(__func__,"conversion failed"); fclose(fd); + free(full_path); return 1; } fclose(fd); + free(full_path); return 0; } -- cgit v1.2.3