Skip to content
Snippets Groups Projects
Commit e15dcba6 authored by Pietro Incardona's avatar Pietro Incardona
Browse files

Fixing pointer check system

parent 70fc7c71
No related branches found
No related tags found
No related merge requests found
......@@ -120,10 +120,6 @@ static bool check_delete(const void * data)
*/
static bool check_valid(const void * ptr, size_t size_access)
{
// get the lower bound
std::map<byte_ptr, size_t>::iterator l_b = active_ptr.upper_bound((byte_ptr)ptr);
if (active_ptr.size() == 0)
{
std::cout << "Error invalid pointer: " << __FILE__ << ":" << __LINE__ << " " << ptr << "\n";
......@@ -131,6 +127,21 @@ static bool check_valid(const void * ptr, size_t size_access)
return false;
}
// get the upper bound
std::map<byte_ptr, size_t>::iterator l_b = active_ptr.upper_bound((byte_ptr)ptr);
// if there is no memory that satisfy the request
if (l_b == active_ptr.begin())
{
if (process_to_print < 0 || process_to_print == process_v_cl)
{
std::cout << "Error invalid pointer: " << __FILE__ << ":" << __LINE__ << " " << ptr << "\n";
ACTION_ON_ERROR(MEM_ERROR);
}
return false;
}
//! subtract one
l_b--;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment