free_mem in sharpen

This commit is contained in:
jazzy1902 2024-11-04 02:51:00 +05:30
parent dd25645335
commit be78df9fe5
1 changed files with 9 additions and 4 deletions

View File

@ -171,15 +171,20 @@ int main(int argc, char **argv)
struct image_t *details_image;
struct image_t *sharpened_image;
for (int i = 0; i < 500; i++) {
int reps = 1000;
for (int i = 0; i < reps; i++) {
smoothened_image = S1_smoothen(input_image);
details_image = S2_find_details(input_image, smoothened_image);
sharpened_image = S3_sharpen(input_image, details_image);
// Free memory to avoid memory leaks
// free_image(smoothened_image);
// free_image(details_image);
// free_image(sharpened_image);
if(i == reps-1) {
continue;
}
free_image(smoothened_image);
free_image(details_image);
free_image(sharpened_image);
}
write_ppm_file(argv[2], sharpened_image);