Commit 1c89a75d authored by Andrew McDonnell's avatar Andrew McDonnell

Fix one memory leak (caused by not freeing found cursor in find_vertices)...

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