From ac3b1dda63944f2cc8caaa52344774255e1956c8 Mon Sep 17 00:00:00 2001 From: yzrh Date: Thu, 22 Dec 2022 11:22:41 +0000 Subject: Fix memory leak and data type. Signed-off-by: yzrh --- src/pdf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/pdf.c') diff --git a/src/pdf.c b/src/pdf.c index 6700e5b..de98706 100644 --- a/src/pdf.c +++ b/src/pdf.c @@ -120,7 +120,7 @@ pdf_obj_add(pdf_object_t **pdf, int id, if ((*pdf)->stream == NULL) return 1; - memcpy((*pdf)->stream, stream, (*pdf)->stream_size); + memcpy((*pdf)->stream, stream, stream_size); (*pdf)->stream[(*pdf)->stream_size - 1] = '\n'; } else { (*pdf)->stream_size = 0; @@ -249,7 +249,7 @@ pdf_obj_replace(pdf_object_t **pdf, int id, ptr->stream_size = stream_size + 1; ptr->stream = ret; - memcpy(ptr->stream, stream, ptr->stream_size); + memcpy(ptr->stream, stream, stream_size); ptr->stream[ptr->stream_size - 1] = '\n'; } -- cgit v1.2.3