diff --git a/src/road_map.cpp b/src/road_map.cpp
index 07d0603e00db83e2db79ecaa5bcf2b78dc051c1a..dd9e4bb5e419032536bfee23ac818834ba085844 100644
--- a/src/road_map.cpp
+++ b/src/road_map.cpp
@@ -27,12 +27,17 @@ void CRoadMap::free(void)
       delete this->roads[i];
       this->roads[i]=NULL;
     }
+  this->roads.clear();
   for(unsigned int i=0;i<this->junctions.size();i++)
     if(this->junctions[i]!=NULL)
     {
       delete this->junctions[i];
       this->junctions[i]=NULL;
     }
+  this->junctions.clear();
+  this->next_segment_id=0;
+  this->next_road_id=0;
+  this->next_junction_id=0;
 }
 
 unsigned int CRoadMap::get_next_segment_id(void)
@@ -217,6 +222,7 @@ void CRoadMap::load_opendrive(const std::string &filename)
   opendrive_map_pair_t map_pair;
   std::vector<CRoad *> segment_roads;
 
+  this->free();
   if(stat(filename.c_str(),&buffer)==0)
   {
     try{
@@ -378,6 +384,7 @@ void CRoadMap::load_osm(const std::string &filename)
 {
   COSMMap road_map;
 
+  this->free();
   road_map.load(filename);
   road_map.convert(*this);
 }