Skip to content

Commit a5c98da

Browse files
committed
fix: correct some memory leaks upon error
1 parent 4fd6ea0 commit a5c98da

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/_igraph/graphobject.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7595,6 +7595,7 @@ PyObject *igraphmodule_Graph_motifs_randesu(igraphmodule_GraphObject *self,
75957595
return NULL;
75967596
Py_RETURN_NONE;
75977597
} else {
7598+
igraph_vector_destroy(&cut_prob);
75987599
PyErr_SetString(PyExc_TypeError, "callback must be callable or None");
75997600
return NULL;
76007601
}
@@ -11747,11 +11748,14 @@ PyObject *igraphmodule_Graph_bfs(igraphmodule_GraphObject * self,
1174711748

1174811749
if (igraph_vector_int_init(&parents, igraph_vcount(&self->g))) {
1174911750
igraph_vector_int_destroy(&vids);
11750-
igraph_vector_int_destroy(&parents);
11751+
igraph_vector_int_destroy(&layers);
1175111752
return igraphmodule_handle_igraph_error();
1175211753
}
1175311754

1175411755
if (igraph_bfs_simple(&self->g, vid, mode, &vids, &layers, &parents)) {
11756+
igraph_vector_int_destroy(&vids);
11757+
igraph_vector_int_destroy(&layers);
11758+
igraph_vector_int_destroy(&parents);
1175511759
igraphmodule_handle_igraph_error();
1175611760
return NULL;
1175711761
}

0 commit comments

Comments
 (0)