Fix memory leaks in Monitor class

This commit is contained in:
manupap1 2014-11-15 12:57:10 +01:00
parent f120546f9e
commit 658b9abea9
1 changed files with 7 additions and 1 deletions

View File

@ -1241,7 +1241,6 @@ bool Monitor::Analyse()
if ( static_undef ) if ( static_undef )
{ {
static_undef = false;
timestamps = new struct timeval *[pre_event_count]; timestamps = new struct timeval *[pre_event_count];
images = new Image *[pre_event_count]; images = new Image *[pre_event_count];
last_signal = shared_data->signal; last_signal = shared_data->signal;
@ -1626,6 +1625,13 @@ bool Monitor::Analyse()
last_signal = signal; last_signal = signal;
} }
if ( static_undef )
{
delete[] timestamps;
delete[] images;
static_undef = false;
}
shared_data->last_read_index = index%image_buffer_count; shared_data->last_read_index = index%image_buffer_count;
//shared_data->last_read_time = image_buffer[index].timestamp->tv_sec; //shared_data->last_read_time = image_buffer[index].timestamp->tv_sec;
shared_data->last_read_time = now.tv_sec; shared_data->last_read_time = now.tv_sec;