From b1350cf3928a7dd42904fe8fcac4bde965a82ac1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 21 May 2014 15:37:18 +1000 Subject: [PATCH] Fix for uninitialized memory use in Cycles --- intern/cycles/render/attribute.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/intern/cycles/render/attribute.cpp b/intern/cycles/render/attribute.cpp index 14805b6f11a..72781bb0f9b 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);