Skip to content

Commit 2298aac

Browse files
committed
moved new() statements around to avoid potential memory leaks
1 parent 3a9c3fa commit 2298aac

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libraries/HDDM/DEventSourceREST.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,6 @@ jerror_t DEventSourceREST::Extract_DBeamPhoton(hddm_r::HDDM *record,
620620
{
621621
if (locTAGMiter->getJtag() != tag)
622622
continue;
623-
624-
DBeamPhoton* gamma = new DBeamPhoton();
625623

626624
// load the counter number (if it exists) and set the energy based on the counter
627625
unsigned int column = 0;
@@ -654,6 +652,8 @@ jerror_t DEventSourceREST::Extract_DBeamPhoton(hddm_r::HDDM *record,
654652
continue;
655653
}
656654

655+
DBeamPhoton* gamma = new DBeamPhoton();
656+
657657
double Elo_tagm = tagmGeom->getElow(column);
658658
double Ehi_tagm = tagmGeom->getEhigh(column);
659659
double Ebeam_tagm = (Elo_tagm + Ehi_tagm)/2.;
@@ -682,8 +682,6 @@ jerror_t DEventSourceREST::Extract_DBeamPhoton(hddm_r::HDDM *record,
682682
if (locTAGHiter->getJtag() != tag)
683683
continue;
684684

685-
DBeamPhoton* gamma = new DBeamPhoton();
686-
687685
// load the counter number (if it exists) and set the energy based on the counter
688686
unsigned int counter = 0;
689687
hddm_r::TaghChannelList &locTaghChannelList = locTAGHiter->getTaghChannels();
@@ -715,6 +713,8 @@ jerror_t DEventSourceREST::Extract_DBeamPhoton(hddm_r::HDDM *record,
715713
continue;
716714
}
717715

716+
DBeamPhoton* gamma = new DBeamPhoton();
717+
718718
double Elo_tagh = taghGeom->getElow(counter);
719719
double Ehi_tagh = taghGeom->getEhigh(counter);
720720
double Ebeam_tagh = (Elo_tagh + Ehi_tagh)/2.;

0 commit comments

Comments
 (0)