diff --git a/DDG4/plugins/Geant4EventReaderHepMC.cpp b/DDG4/plugins/Geant4EventReaderHepMC.cpp index 72d624f645f8b204db519c77c925f4880244c66a..2409c9520e3ac85e7962079093ead3a43d53f987 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;