]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Get rid of a null pointer dereference.
authorDavid Wells <wellsd2@rpi.edu>
Tue, 3 Jan 2017 17:43:45 +0000 (12:43 -0500)
committerDavid Wells <wellsd2@rpi.edu>
Thu, 5 Jan 2017 03:08:30 +0000 (22:08 -0500)
This was caught by cppcheck.

include/deal.II/lac/iterative_inverse.h

index 8ca447fb97b91f359773f1f7787dfc8f0b9701d0..e0d9dc22505abf46a623ba061741a36e1bbfba76 100644 (file)
@@ -129,10 +129,9 @@ inline
 void
 IterativeInverse<VectorType>::initialize(const MatrixType &m, const PreconditionerType &p)
 {
-  // dummy variable
-  VectorType *v = 0;
-  matrix = std_cxx11::shared_ptr<PointerMatrixBase<VectorType> > (new_pointer_matrix_base(m, *v));
-  preconditioner = std_cxx11::shared_ptr<PointerMatrixBase<VectorType> > (new_pointer_matrix_base(p, *v));
+  VectorType v;
+  matrix = std_cxx11::shared_ptr<PointerMatrixBase<VectorType> > (new_pointer_matrix_base(m, v));
+  preconditioner = std_cxx11::shared_ptr<PointerMatrixBase<VectorType> > (new_pointer_matrix_base(p, v));
 }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.