[Bf-blender-cvs] [a89a2606341] temp-cycles-denoising: Cycles Denoising: Fix crash in CPUDevice

Lukas Stockner noreply at git.blender.org
Thu May 4 14:20:48 CEST 2017


Commit: a89a260634149aba9458043a98170be216f3657e
Author: Lukas Stockner
Date:   Wed May 3 21:41:14 2017 +0200
Branches: temp-cycles-denoising
https://developer.blender.org/rBa89a260634149aba9458043a98170be216f3657e

Cycles Denoising: Fix crash in CPUDevice

The code initialized allocated memory by assigning the KernelGlobals to it. However, that calls the assignment operator, which frees previous elements which were never allocated.

===================================================================

M	intern/cycles/device/device_cpu.cpp

===================================================================

diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index a84d0db7ac3..3d95bac1eda 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -663,8 +663,7 @@ public:
 		kgbuffer.resize(1);
 		mem_alloc("kernel_globals", kgbuffer, MEM_READ_WRITE);
 
-		KernelGlobals *kg = (KernelGlobals*)kgbuffer.device_pointer;
-		*kg = thread_kernel_globals_init();
+		KernelGlobals *kg = new((void*)kgbuffer.device_pointer) KernelGlobals(thread_kernel_globals_init());
 
 		CPUSplitKernel *split_kernel = NULL;
 		if(use_split_kernel) {




More information about the Bf-blender-cvs mailing list