ghostscript/ghostscript-jbig2-image-refcount.patch

26 lines
917 B
Diff
Raw Normal View History

diff -up ghostscript-8.71/jbig2dec/jbig2_image.c.jbig2-image-refcount ghostscript-8.71/jbig2dec/jbig2_image.c
--- ghostscript-8.71/jbig2dec/jbig2_image.c.jbig2-image-refcount 2010-08-05 14:55:56.417043303 +0100
+++ ghostscript-8.71/jbig2dec/jbig2_image.c 2010-08-05 14:56:46.796169065 +0100
@@ -60,15 +60,18 @@ Jbig2Image* jbig2_image_new(Jbig2Ctx *ct
/* clone an image pointer by bumping its reference count */
Jbig2Image* jbig2_image_clone(Jbig2Ctx *ctx, Jbig2Image *image)
{
- image->refcount++;
+ if (image)
+ image->refcount++;
return image;
}
/* release an image pointer, freeing it it appropriate */
void jbig2_image_release(Jbig2Ctx *ctx, Jbig2Image *image)
{
- image->refcount--;
- if (!image->refcount) jbig2_image_free(ctx, image);
+ if (image) {
+ image->refcount--;
+ if (!image->refcount) jbig2_image_free(ctx, image);
+ }
}
/* free a Jbig2Image structure and its associated memory */