diff options
-rw-r--r-- | include/mupdf/pdf/document.h | 2 | ||||
-rw-r--r-- | source/fitz/stream-open.c | 2 | ||||
-rw-r--r-- | source/pdf/pdf-appearance.c | 1 | ||||
-rw-r--r-- | source/pdf/pdf-signature.c | 8 | ||||
-rw-r--r-- | source/pdf/pdf-write.c | 2 |
5 files changed, 11 insertions, 4 deletions
diff --git a/include/mupdf/pdf/document.h b/include/mupdf/pdf/document.h index e2dd580a..f73cf5f3 100644 --- a/include/mupdf/pdf/document.h +++ b/include/mupdf/pdf/document.h @@ -919,8 +919,6 @@ int pdf_has_unsaved_sigs(fz_context *ctx, pdf_document *doc); /* pdf_write_document: Write out the document to an output stream with all changes finalised. - - This method will throw an error if pdf_has_unsaved_sigs. */ void pdf_write_document(fz_context *ctx, pdf_document *doc, fz_output *out, pdf_write_options *opts); diff --git a/source/fitz/stream-open.c b/source/fitz/stream-open.c index 39994285..bc31c3b7 100644 --- a/source/fitz/stream-open.c +++ b/source/fitz/stream-open.c @@ -148,7 +148,7 @@ fz_stream *fz_open_file_ptr_no_close(fz_context *ctx, FILE *file) { fz_stream *stm = fz_open_file_ptr(ctx, file); /* We don't own the file ptr. Ensure we don't close it */ - stm->drop = NULL; + stm->drop = fz_free; return stm; } diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c index a23bbaf1..67a01fa9 100644 --- a/source/pdf/pdf-appearance.c +++ b/source/pdf/pdf-appearance.c @@ -1282,6 +1282,7 @@ void pdf_update_signature_appearance(fz_context *ctx, pdf_annot *annot, const ch fz_drop_font(ctx, helv); fz_drop_font(ctx, zadb); pdf_drop_obj(ctx, res); + fz_drop_buffer(ctx, buf); } fz_catch(ctx) { diff --git a/source/pdf/pdf-signature.c b/source/pdf/pdf-signature.c index 213c33e1..4d62e7f1 100644 --- a/source/pdf/pdf-signature.c +++ b/source/pdf/pdf-signature.c @@ -7,12 +7,14 @@ void pdf_write_digest(fz_context *ctx, fz_output *out, pdf_obj *byte_range, int hexdigest_offset, int hexdigest_length, pdf_pkcs7_signer *signer) { + fz_stream *stm = NULL; fz_stream *in = NULL; fz_range *brange = NULL; int brange_len = pdf_array_len(ctx, byte_range)/2; unsigned char *digest = NULL; int digest_len; + fz_var(stm); fz_var(in); fz_var(brange); @@ -30,7 +32,8 @@ void pdf_write_digest(fz_context *ctx, fz_output *out, pdf_obj *byte_range, int brange[i].len = pdf_array_get_int(ctx, byte_range, 2*i+1); } - in = fz_open_null_n(ctx, fz_stream_from_output(ctx, out), brange, brange_len); + stm = fz_stream_from_output(ctx, out); + in = fz_open_null_n(ctx, stm, brange, brange_len); digest_len = (hexdigest_length - 2) / 2; digest = fz_malloc(ctx, digest_len); @@ -40,6 +43,8 @@ void pdf_write_digest(fz_context *ctx, fz_output *out, pdf_obj *byte_range, int fz_drop_stream(ctx, in); in = NULL; + fz_drop_stream(ctx, stm); + stm = NULL; fz_seek_output(ctx, out, hexdigest_offset+1, SEEK_SET); @@ -50,6 +55,7 @@ void pdf_write_digest(fz_context *ctx, fz_output *out, pdf_obj *byte_range, int { fz_free(ctx, digest); fz_free(ctx, brange); + fz_drop_stream(ctx, stm); fz_drop_stream(ctx, in); } fz_catch(ctx) diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c index f1f49299..53a63cfc 100644 --- a/source/pdf/pdf-write.c +++ b/source/pdf/pdf-write.c @@ -2710,6 +2710,8 @@ static void complete_signatures(fz_context *ctx, pdf_document *doc, pdf_write_st usig->signer->drop(usig->signer); fz_free(ctx, usig); } + + xref->unsaved_sigs_end = NULL; } } } |