From 89f5ba121c869e5d3b3bd56025dfae8e9b33e06c Mon Sep 17 00:00:00 2001 From: Andre Sailer <andre.philippe.sailer@cern.ch> Date: Thu, 18 Jun 2015 15:23:03 +0000 Subject: [PATCH] Coverity 59268: delete pointer when exiting and is has not been assigned yet --- DDG4/plugins/Geant4EventReaderHepMC.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/DDG4/plugins/Geant4EventReaderHepMC.cpp b/DDG4/plugins/Geant4EventReaderHepMC.cpp index 72d624f64..2409c9520 100644 --- a/DDG4/plugins/Geant4EventReaderHepMC.cpp +++ b/DDG4/plugins/Geant4EventReaderHepMC.cpp @@ -371,16 +371,20 @@ int HepMC::read_vertex(EventStream &info, istream& is, istringstream & input) input >> id >> dummy >> v->x >> v->y >> v->z >> v->time >> num_orphans_in >> num_particles_out >> weights_size; - if(!input) + if(!input) { + delete v; return 0; + } v->x *= info.pos_unit; v->y *= info.pos_unit; v->z *= info.pos_unit; weights.resize(weights_size); for (int i1 = 0; i1 < weights_size; ++i1) { input >> weights[i1]; - if(!input) + if(!input) { + delete v; return 0; + } } info.vertices().insert(make_pair(id,v)); //cout << "Add Vertex:" << id << endl; -- GitLab