diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2015-11-25 22:31:20 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2015-11-25 22:31:52 +0300 |
commit | b2a4aab9e4bdff9e5c5828186472c4993e2cda0d (patch) | |
tree | e19a0adb3158e7b70a36cdc3653e3509d4964c4a /intern/opennl | |
parent | d4ad89c1eeb306b4e0d85d9c5d04656b47e4b5bf (diff) |
Fix T46848: more OpenNL crashes due to uninitialized variables.
Diffstat (limited to 'intern/opennl')
-rw-r--r-- | intern/opennl/intern/opennl.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/intern/opennl/intern/opennl.cpp b/intern/opennl/intern/opennl.cpp index 446a1a38f0d..331291e790a 100644 --- a/intern/opennl/intern/opennl.cpp +++ b/intern/opennl/intern/opennl.cpp @@ -57,17 +57,28 @@ typedef Eigen::Triplet<double> EigenTriplet; /* NLContext data structure */ -typedef struct { +struct NLCoeff { + NLCoeff() + { + index = 0; + value = 0.0; + } NLuint index; NLdouble value; -} NLCoeff; +}; -typedef struct { +struct NLVariable { + NLVariable() + { + memset(value, 0, sizeof(value)); + locked = false; + index = 0; + } NLdouble value[4]; NLboolean locked; NLuint index; std::vector<NLCoeff> a; -} NLVariable; +}; #define NL_STATE_INITIAL 0 #define NL_STATE_SYSTEM 1 @@ -340,7 +351,9 @@ void nlMatrixAdd(NLContext *context, NLuint row, NLuint col, NLdouble value) if(!context->least_squares) row = context->variable[row].index; - NLCoeff coeff = {row, value}; + NLCoeff coeff; + coeff.index = row; + coeff.value = value; context->variable[col].a.push_back(coeff); } else { |