[Bf-blender-cvs] [b1350cf] master: Fix for uninitialized memory use in Cycles

Campbell Barton noreply at git.blender.org
Wed May 21 07:41:55 CEST 2014


Commit: b1350cf3928a7dd42904fe8fcac4bde965a82ac1
Author: Campbell Barton
Date:   Wed May 21 15:37:18 2014 +1000
https://developer.blender.org/rBb1350cf3928a7dd42904fe8fcac4bde965a82ac1

Fix for uninitialized memory use in Cycles

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

M	intern/cycles/render/attribute.cpp

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

diff --git a/intern/cycles/render/attribute.cpp b/intern/cycles/render/attribute.cpp
index 14805b6..72781bb 100644
--- a/intern/cycles/render/attribute.cpp
+++ b/intern/cycles/render/attribute.cpp
@@ -263,11 +263,19 @@ Attribute *AttributeSet::add(ustring name, TypeDesc type, AttributeElement eleme
 		remove(name);
 	}
 
-	attributes.push_back(Attribute());
+#if __cplusplus >= 201103L
+	attributes.emplace_back();
 	attr = &attributes.back();
-
 	attr->set(name, type, element);
-	
+#else
+	{
+		Attribute attr_temp;
+		attr_temp.set(name, type, element);
+		attributes.push_back(attr_temp);
+		attr = &attributes.back();
+	}
+#endif
+
 	/* this is weak .. */
 	if(triangle_mesh)
 		attr->reserve(triangle_mesh->verts.size(), triangle_mesh->triangles.size(), triangle_mesh->motion_steps, 0, 0, resize);




More information about the Bf-blender-cvs mailing list