From 47487b76109e231e255d34405dbdd97e0f15ae47 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Mon, 3 Mar 2025 18:29:04 -0600 Subject: [PATCH] Don't free stringargs during deep copy spawnsectors is memcpy'd over just before the calls to copy_stringarg, resulting in copy_stringarg Z_Free'ing the exact string it is about to copy. This is a silent memory error, as the malloc block appears to still be in a virtual-allocated page after the call to Z_Free. deepcopy is not able to properly free the target array's tree of objects if the target already exists, so that will need future work. --- src/p_deepcopy.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/p_deepcopy.cpp b/src/p_deepcopy.cpp index 9441dc96a..dd4a64c96 100644 --- a/src/p_deepcopy.cpp +++ b/src/p_deepcopy.cpp @@ -142,11 +142,6 @@ static void copy_stringarg(char **target, const char *source) // on how it is copied over instead of just // using strcpy or smth - if (*target != nullptr) - { - Z_Free(*target); - } - size_t len = 0; if (source != nullptr) {