aboutsummaryrefslogtreecommitdiffstats
path: root/src/pdf_writer.c
diff options
context:
space:
mode:
authoryzrh <yzrh@noema.org>2022-12-22 11:22:41 +0000
committeryzrh <yzrh@noema.org>2022-12-22 19:48:48 +0000
commitac3b1dda63944f2cc8caaa52344774255e1956c8 (patch)
tree2fb8b24fbfe8002f39288926fa06c71100102868 /src/pdf_writer.c
parent63728e1340a27b7ae629a747229871f3dc670de5 (diff)
downloadmelon-ac3b1dda63944f2cc8caaa52344774255e1956c8.tar.gz
melon-ac3b1dda63944f2cc8caaa52344774255e1956c8.tar.zst
Fix memory leak and data type.
Signed-off-by: yzrh <yzrh@noema.org>
Diffstat (limited to 'src/pdf_writer.c')
-rw-r--r--src/pdf_writer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pdf_writer.c b/src/pdf_writer.c
index cd188fc..be64e49 100644
--- a/src/pdf_writer.c
+++ b/src/pdf_writer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020-2021, yzrh <yzrh@noema.org>
+ * Copyright (c) 2020-2022, yzrh <yzrh@noema.org>
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -138,7 +138,11 @@ pdf_dump_trailer(pdf_object_t **pdf, FILE **fp, int xref)
int buf_size;
char buf[64];
+#ifdef __ILP32__
+ buf_size = snprintf(buf, 64, "%x%x", timestamp, size);
+#else
buf_size = snprintf(buf, 64, "%lx%x", timestamp, size);
+#endif
unsigned char str[64];
memcpy(str, buf, 64);