sot / chandra_time

Convert between various time formats relevant to Chandra.
https://sot.github.io/Chandra.Time
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

XTime.h:714 #33

Open textbrowser opened 4 years ago

textbrowser commented 4 years ago

XTRList::tr is sometimes allocated using new and always deleted using delete [] in the destructor. These mismatches may result in undefined behavior.

// Description: // Destructor inline XTRList::~XTRList () { delete [] tr ; }

// Description: // Default constructor for a single XTimeRange List inline XTRList::XTRList (void) : numXTRs (1), empty(1) { tr = new XTimeRange () ; listRange =* tr ; }

// Description: // Constructor for a single XTimeRange List inline XTRList::XTRList (const XTimeRange &T) : listRange (T), numXTRs (1) { tr = new XTimeRange (T) ; empty = T.isEmpty () ; }

// Description: // Copy constructor for a new TR list XTRList::XTRList (const XTRList &trl) { numXTRs = trl.numXTRs ; listRange = trl.listRange ; empty = trl.empty ; tr = new XTimeRange[numXTRs] ; for (int i=0; i<numXTRs; i++) tr[i] = trl.tr[i] ; return ; }