diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-05-21 09:37:18 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-05-21 09:40:52 +0400 |
commit | b1350cf3928a7dd42904fe8fcac4bde965a82ac1 (patch) | |
tree | 2544dbb7ca67406cfd4153c27ba50b69a7b81aa8 /intern | |
parent | 628353835cc697dfc028088ff583620625a07393 (diff) |
Fix for uninitialized memory use in Cycles
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/render/attribute.cpp | 14 |
1 files 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); |