From 363abce351c949373a563b6abff75f1d0bd565dd Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 24 May 2022 14:07:17 +0200 Subject: [PATCH] small fixes --- src/runtime/c/pgf/db.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/c/pgf/db.cxx b/src/runtime/c/pgf/db.cxx index 0222bed1b..94209b0a7 100644 --- a/src/runtime/c/pgf/db.cxx +++ b/src/runtime/c/pgf/db.cxx @@ -1149,13 +1149,15 @@ object PgfDB::realloc_internal(object oldo, size_t old_bytes, size_t new_bytes) // If the object is at the end of the allocation area top += nb; +#ifdef DEBUG_MEMORY_ALLOCATOR fprintf(stderr, "realloc_internal(%016lx,%ld,%ld)\n", oldo, old_bytes, new_bytes); +#endif return oldo; } object newo = malloc_internal(new_bytes); - memcpy(base+newo, base+oldo, old_bytes); + memcpy(base+newo, base+oldo, std::min(old_bytes,new_bytes)); free_internal(oldo, old_bytes); return newo; }