From 3fe7c445f390af803f0adaeb6901f5f984ae0917 Mon Sep 17 00:00:00 2001 From: David Hilvert Date: Tue, 27 Mar 2007 04:56:00 +0000 Subject: [PATCH] d2::render::ipc: Modify allocation for subdomain arguments to use new[] and delete[], so as to ensure correct initialization of STL class instances. darcs-hash:20070327045615-d1b56-369422b015b2ccb8fceba3fbfd43beaee2528245.gz --- d2/render/ipc.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/d2/render/ipc.h b/d2/render/ipc.h index 8e66519..9dcccd0 100644 --- a/d2/render/ipc.h +++ b/d2/render/ipc.h @@ -331,7 +331,7 @@ protected: N = 1; #endif - sim_subdomain_args *args = (sim_subdomain_args *) malloc(sizeof(sim_subdomain_args) * N); + sim_subdomain_args *args = new sim_subdomain_args[N]; /* @@ -405,7 +405,7 @@ protected: */ if (nlsimulated == NULL) { - delete args; + delete[] args; return; } @@ -465,7 +465,7 @@ protected: delete nlsim_weights; - delete args; + delete[] args; } struct correction_t { @@ -916,7 +916,7 @@ protected: N = 1; #endif - correct_subdomain_args *args = (correct_subdomain_args *) malloc(sizeof(correct_subdomain_args) * N); + correct_subdomain_args *args = new correct_subdomain_args[N]; for (int ti = 0; ti < N; ti++) { args[ti].frame_num = frame_num; @@ -1060,6 +1060,8 @@ protected: if (nlsimulated) delete lreal; + + delete[] args; } /* -- 2.11.4.GIT