Commit 590e0969 authored by Andrew McDonnell's avatar Andrew McDonnell

Fix memory leak introduced in the fix for lp:1196020. oops. Caused by not...

Fix memory leak introduced in the fix for lp:1196020. oops. Caused by not freeing found cursor in find_vertices() function.
parents fe1afa65 1c89a75d
......@@ -482,9 +482,10 @@ namespace boost
// Fix for https://bugs.launchpad.net/oqgraph/+bug/1196020 returning vertex even when not in graph
// Psuedocode for fix:
// if count(*) from g->TABLE where source=id or target=id > 0 then return id else return null
oqgraph3::cursor* found = new oqgraph3::cursor(const_cast<oqgraph3::graph*>(&g));
if (found->seek_to(id, boost::none) &&
found->seek_to(boost::none, id)) {
oqgraph3::cursor* found_cursor = new oqgraph3::cursor(const_cast<oqgraph3::graph*>(&g));
bool found = (found_cursor->seek_to(id, boost::none) && found_cursor->seek_to(boost::none, id));
delete found_cursor;
if (found) {
// id is neither a from or a to in a link
return optional<graph_traits<oqgraph3::graph>::vertex_descriptor>();
}
......
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