[Bf-blender-cvs] [b2a4aab] master: Fix T46848: more OpenNL crashes due to uninitialized variables.
Brecht Van Lommel
noreply at git.blender.org
Wed Nov 25 20:34:39 CET 2015
Commit: b2a4aab9e4bdff9e5c5828186472c4993e2cda0d
Author: Brecht Van Lommel
Date: Wed Nov 25 20:31:20 2015 +0100
Branches: master
https://developer.blender.org/rBb2a4aab9e4bdff9e5c5828186472c4993e2cda0d
Fix T46848: more OpenNL crashes due to uninitialized variables.
===================================================================
M intern/opennl/intern/opennl.cpp
===================================================================
diff --git a/intern/opennl/intern/opennl.cpp b/intern/opennl/intern/opennl.cpp
index 446a1a3..331291e 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 {
More information about the Bf-blender-cvs
mailing list