Re: Bug 686991 Memory leak in CET test file 12-07.ps
Ray Johnston <[email protected]>
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Message-ID | <[email protected]> |
Dan,
Looks like a good patch to me. As expected, the CET was probing
error conditions.
I think you should commit this so that it is in 8.11. The risk seems
acceptably small, and I never like having potential GC problems
laying around.
Regards,
Ray
____________________________________________________________________
Dan Coby wrote:
> Fix for Bug 686991 Memory leak in CET test file 12-07.ps.
>
> DETAILS:
>
> A pointer to a free object was found while running the CET with the
> memory allocation test switches (-Z@?$). The free object was a color
> space and the pointer was inside a gs_image_enum_common structure.
>
> The situation occurs when an error is found in the data source for
> for an image. The actual cause was that the image enum common
> structure should have also been released.
>
> Note: The data source checking is the only place that has this
> problem. After the data source checking, the image enum common
> structure pointer is placed into an image enum structure. Errors
> that are detected after that point call gx_image_cleanup which
> handles all of the data in the image enum structure including the
> image enum common structure.
>
>
> Fix:
>
> Index: src/zimage.c
> ===================================================================
> RCS file: /cvs/ghostscript/gs/src/zimage.c,v
> retrieving revision 1.11
> diff -c -5 -r1.11 zimage.c
> *** src/zimage.c 20 Jun 2003 11:23:48 -0000 1.11
> --- src/zimage.c 10 Aug 2003 05:21:08 -0000
> ***************
> *** 275,291 ****
> break;
> }
> }
> /* falls through */
> case t_string:
> ! if (r_type(pp) != r_type(sources))
> return_error(e_typecheck);
> check_read(*pp);
> break;
> default:
> ! if (!r_is_proc(sources))
> return_error(e_typecheck);
> check_proc(*pp);
> }
> *ep = *pp;
> }
> if ((penum = gs_image_enum_alloc(imemory, "image_setup")) == 0)
> --- 275,297 ----
> break;
> }
> }
> /* falls through */
> case t_string:
> ! if (r_type(pp) != r_type(sources)) {
> ! if (pie != NULL)
> ! gx_image_end(pie, false); /* Clean up pie */
> return_error(e_typecheck);
> + }
> check_read(*pp);
> break;
> default:
> ! if (!r_is_proc(sources)) {
> ! if (pie != NULL)
> ! gx_image_end(pie, false); /* Clean up pie */
> return_error(e_typecheck);
> + }
> check_proc(*pp);
> }
> _______________________________________________
> gs-code-review mailing list
> [email protected]
> http://www.ghostscript.com/mailman/listinfo/gs-code-review
>
>