Commit e7c4d323 authored by Frederic Logier's avatar Frederic Logier
Browse files

removed memory leaks on mongodb wrapper

parent 94aa17b5
......@@ -75,7 +75,7 @@ Mongodb::Mongodb(QString a_server, QString a_database) : m_server(a_server), m_d
try {
scoped_ptr<ScopedDbConnection> connPtr( ScopedDbConnection::getScopedDbConnection( m_server.toStdString() ));
QScopedPointer<ScopedDbConnection> connPtr( ScopedDbConnection::getScopedDbConnection( m_server.toStdString() ));
ScopedDbConnection& replicaset = *connPtr;
if (!replicaset.ok())
......@@ -464,9 +464,9 @@ bo Mongodb::ExtractJSON(const be &gfs_id)
}
json_tmp.close();
delete(this->m_gf);
}
}
delete(m_gf);
}
return m_bo_json;
}
......@@ -494,11 +494,11 @@ QBool Mongodb::ExtractBinary(const be &gfs_id, string path, QString &filename)
string l_path = path + m_gf->getFilename();
QFile binary_tmp(l_path.data());
m_gf->write(binary_tmp.fileName().toStdString().c_str());
delete(m_gf);
//qDebug() << "Find file : delete";
}
}
delete(m_gf);
return QBool(true);
}
}
return QBool(false);
}
......@@ -528,7 +528,6 @@ QBool Mongodb::ReadFile(const be &gfs_id, const mongo::GridFile **a_gf)
else break;
}
replicaset.done();
delete(*a_gf);
return QBool(true);
}
}
......@@ -732,6 +731,7 @@ QBool Mongodb::ExtractByChunck(const be &gfs_id, int chunk_index, QByteArray &ch
replicaset.done();
delete(m_grid_file);
delete(l_chunk_data);
return QBool(true);
}
else
......@@ -739,7 +739,8 @@ QBool Mongodb::ExtractByChunck(const be &gfs_id, int chunk_index, QByteArray &ch
//*chunk_data = NULL;
chunk_data.clear();
replicaset.done();
delete(m_grid_file);
delete(m_grid_file);
delete(l_chunk_data);
return QBool(false);
}
}
......
......@@ -1614,13 +1614,13 @@ void Zstream_push::stream_payload()
//out.write(requestContent);
//out.close();
QByteArray chunk_data;
for ( int chunk_index = 0; chunk_index < num_chunck; chunk_index++ )
{
std::cout << "BEFORE GET CHUNCK " << std::endl;
int chunk_length;
QByteArray chunk_data;
QBool res = mongodb_->ExtractByChunck(gfsid.firstElement(), chunk_index, chunk_data, chunk_length);
//std::cout << "AFTER GET CHUNCK chunk_data : " << chunk_data << std::endl;
......@@ -1651,7 +1651,6 @@ void Zstream_push::stream_payload()
break;
}
}
chunk_data.clear();
}
//out.close();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment