aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/prog.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/prog.c b/src/prog.c
index 528450e..e08bb72 100644
--- a/src/prog.c
+++ b/src/prog.c
@@ -9,6 +9,7 @@
#include <lib/dir.h>
#include <lib/file.h>
#include <lib/lib.h>
+#include <lib/mem/galloc.h>
#include <lib/monad.h>
#include <lib/png.h>
#include <lib/seg/mask_data.h>
@@ -96,7 +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) {
- free(file_list[index]);
+ g_free(file_list[index]);
continue;
}
// If we have a tiff file
@@ -106,7 +107,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) {
- free(file_list[index]);
+ g_free(file_list[index]);
continue;
}
if (!suppress_outputs_b) {
@@ -117,8 +118,8 @@ int main(int arg_count, char **arg_value) {
//-----------------------------------------------
Mask *file_im = tif_to_labels(fpath, &starting_label);
if (file_im == NULL) {
- free(fpath);
- free(file_list[index]);
+ g_free(fpath);
+ g_free(file_list[index]);
continue;
}
//-----------------------------------------------
@@ -126,10 +127,10 @@ int main(int arg_count, char **arg_value) {
//-----------------------------------------------
masks_im = combine_masks(masks_im, file_im);
free_image_mask(file_im);
- free(fpath);
- free(file_list[index]);
+ g_free(fpath);
+ g_free(file_list[index]);
}
- free(file_list);
+ g_free(file_list);
}
}
}
@@ -205,7 +206,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);
- free(bitmap);
+ g_free(bitmap);
}
write_array(bin_output_file_fullpath, masks_im->image[0],
width * height * sizeof(MaskData_t));
@@ -215,5 +216,6 @@ int main(int arg_count, char **arg_value) {
if (!suppress_outputs_b) {
printf("Finished in %f ms\n", 1000 * diff_time(&ts_g_end, &ts_g_start));
}
+ printf("Outstanding allocations: %zu\n", g_outstanding_allocations());
return 0;
}