From 00ce37145556279f4982ef52a747cb2f5e3e3081 Mon Sep 17 00:00:00 2001 From: Christian C Date: Wed, 2 Apr 2025 18:15:13 -0700 Subject: Fixed Memory Leak --- src/prog.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/prog.c b/src/prog.c index e08bb72..6999a32 100644 --- a/src/prog.c +++ b/src/prog.c @@ -97,6 +97,7 @@ int main(int arg_count, char **arg_value) { for (size_t index = 0; file_list[index] != NULL; index++) { char *fname = file_list[index]; if (is_tif_ext(fname) == FALSE) { + fprintf(stderr, "Allocation error?\n"); g_free(file_list[index]); continue; } @@ -107,6 +108,7 @@ int main(int arg_count, char **arg_value) { // 4. Free up allocations made in this process char *fpath = full_path(process_directory, fname); if (fpath == NULL) { + fprintf(stderr, "Allocation error?\n"); g_free(file_list[index]); continue; } @@ -118,6 +120,7 @@ int main(int arg_count, char **arg_value) { //----------------------------------------------- Mask *file_im = tif_to_labels(fpath, &starting_label); if (file_im == NULL) { + fprintf(stderr, "Allocation error?\n"); g_free(fpath); g_free(file_list[index]); continue; @@ -206,6 +209,7 @@ int main(int arg_count, char **arg_value) { Bitmap *bitmap = image_mask_data_to_bitmap(masks_im); if (bitmap != NULL) { save_png(bitmap, png_output_file_fullpath); + g_free(bitmap->image_buffer); g_free(bitmap); } write_array(bin_output_file_fullpath, masks_im->image[0], -- cgit v1.2.1