Skip to content

Commit

Permalink
fix: fix a potential memory leak in Graph.get_shortest_path_astar()'s…
Browse files Browse the repository at this point in the history
… heuristic function
  • Loading branch information
ntamas committed Aug 21, 2024
1 parent b3ea60a commit 4fce02b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/_igraph/graphobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -5671,6 +5671,7 @@ igraph_error_t igraphmodule_i_Graph_get_shortest_path_astar_callback(
to_o = igraphmodule_integer_t_to_PyObject(to);
if (to_o == NULL) {
/* Error in conversion, return 1 */
Py_DECREF(from_o);
return IGRAPH_FAILURE;
}

Expand All @@ -5685,9 +5686,11 @@ igraph_error_t igraphmodule_i_Graph_get_shortest_path_astar_callback(

if (igraphmodule_PyObject_to_real_t(result_o, result)) {
/* Error in conversion, return 1 */
Py_DECREF(result_o);
return IGRAPH_FAILURE;
}

Py_DECREF(result_o);
return IGRAPH_SUCCESS;
}

Expand Down

0 comments on commit 4fce02b

Please sign in to comment.