diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2021-12-02 15:09:13 +0000 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2021-12-02 15:18:07 +0000 |
commit | b107bd7c8735f08496cef5ec7ad9bc5e0cedecef (patch) | |
tree | 7107dab79d7ed1c0afcaaf32d01ce9dcaef43961 /pdf | |
parent | 7b7179994c635c044f123762b05b0a3561209f43 (diff) | |
download | ghostpdl-b107bd7c8735f08496cef5ec7ad9bc5e0cedecef.tar.gz |
Fix one memory leak with 0693548_09210_Book4_edit_final.pdf
When setting the DefaultGray or DefaultCMYK color spaces we set the space's
interpreter_data to the PDF_NAME object of the color space and reference count
the name. Unfortunately, we weren't setting the callback function pointer to
deal with the interpreter_data when the color space was freed.
Setting that callback fixes that memory leaks.
Diffstat (limited to 'pdf')
-rw-r--r-- | pdf/pdf_colour.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/pdf/pdf_colour.c b/pdf/pdf_colour.c index e082e63ec..63d7a9ee6 100644 --- a/pdf/pdf_colour.c +++ b/pdf/pdf_colour.c @@ -347,15 +347,14 @@ int pdfi_gs_setgray(pdf_context *ctx, double d) code = gs_setcolorspace(ctx->pgs, ctx->page.DefaultGray_cs); if (code < 0) return code; - pdfi_set_colour_callback(ctx->pgs->color[0].color_space, ctx, NULL); cc.paint.values[0] = d; return gs_setcolor(ctx->pgs, &cc); } else { code = gs_setgray(ctx->pgs, d); if (code < 0) return code; - pdfi_set_colour_callback(ctx->pgs->color[0].color_space, ctx, pdfi_cspace_free_callback); } + pdfi_set_colour_callback(ctx->pgs->color[0].color_space, ctx, pdfi_cspace_free_callback); return 0; } @@ -401,7 +400,6 @@ static int pdfi_gs_setcmykcolor(pdf_context *ctx, double c, double m, double y, code = gs_setcolorspace(ctx->pgs, ctx->page.DefaultCMYK_cs); if (code < 0) return code; - pdfi_set_colour_callback(ctx->pgs->color[0].color_space, ctx, NULL); cc.paint.values[0] = c; cc.paint.values[1] = m; cc.paint.values[2] = y; @@ -411,8 +409,8 @@ static int pdfi_gs_setcmykcolor(pdf_context *ctx, double c, double m, double y, code = gs_setcmykcolor(ctx->pgs, c, m, y, k); if (code < 0) return code; - pdfi_set_colour_callback(ctx->pgs->color[0].color_space, ctx, pdfi_cspace_free_callback); } + pdfi_set_colour_callback(ctx->pgs->color[0].color_space, ctx, pdfi_cspace_free_callback); return 0; } |