Mercurial > octave
changeset 27774:088d5e7a2b7e stable
Fix segfault when calculating patch vertex normals (bug #57353).
* graphics.cc (patch::properties::update_vertex_normals): Use keyword "new" to
dynamically allocate memory for array of vectors.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Thu, 05 Dec 2019 21:10:30 +0100 |
parents | 2d1af61d8f5e |
children | f47bb02c8d06 b191a91b5157 |
files | libinterp/corefcn/graphics.cc |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc Wed Dec 04 12:01:45 2019 -0800 +++ b/libinterp/corefcn/graphics.cc Thu Dec 05 21:10:30 2019 +0100 @@ -9753,7 +9753,8 @@ } // Second step: assign normals to the respective vertices - std::vector<RowVector> vec_vn [num_v]; // list of normals for vertices + // list of normals for vertices + std::vector<RowVector> *vec_vn = new std::vector<RowVector> [num_v]; for (octave_idx_type i = 0; i < num_f; i++) { // get number of corners @@ -9810,6 +9811,8 @@ } } + delete[] vec_vn; + vertexnormals = vn; } else if (reset)