Skip to content

Commit

Permalink
Do not free cf_image_t data structure in _cfImageZoomDelete()
Browse files Browse the repository at this point in the history
The library-internal _cfImageZoom...() API handles zooming of images
with a data structure of type cf_izoom_t. This data structure contains
a pointer to the original image, in cf_image_t format.

The _cfImageZoomNew() funtion gets a pointer to an existing cf_image_t
structure as parameter, the image to work on. It stores the pointer in
its cf_izoom_t structure. It never creates a cf_image_t image.

Because the _cfImageZoom...() API never creates a cf_image_t
structure, it should also never free it. Therefore it is wrong that
_cfImageZoomDelete() calls cfImageClose() which is the function to
free a cf_image_t structure after use.

This was leading to double freeing, as the functions which create a
cf_image_t structure always free it when done.

This caused OpenPrinting/cups-filters#507
  • Loading branch information
tillkamppeter committed Feb 19, 2023
1 parent 076a994 commit 381636a
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion cupsfilters/image-zoom.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ _cfImageZoomDelete(cf_izoom_t *z) // I - Zoom record to free
free(z->rows[0]);
free(z->rows[1]);
free(z->in);
cfImageClose(z->img);
free(z);
}

Expand Down

0 comments on commit 381636a

Please sign in to comment.