Skip to content

Commit b47e917

Browse files
committed
Guard allocation of vertices & edges results of simple_cycles against allocation errors
1 parent f1e7d00 commit b47e917

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/_igraph/graphobject.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7846,9 +7846,15 @@ PyObject *igraphmodule_Graph_simple_cycles(
78467846
return NULL;
78477847

78487848
igraph_vector_int_list_t vertices;
7849-
igraph_vector_int_list_init(&vertices, 0);
7849+
if (!igraph_vector_int_list_init(&vertices, 0)) {
7850+
igraphmodule_handle_igraph_error();
7851+
return NULL;
7852+
}
78507853
igraph_vector_int_list_t edges;
7851-
igraph_vector_int_list_init(&edges, 0);
7854+
if (!igraph_vector_int_list_init(&edges, 0)) {
7855+
igraphmodule_handle_igraph_error();
7856+
return NULL;
7857+
}
78527858

78537859
if (igraph_simple_cycles(
78547860
&self->g, use_edges ? NULL : &vertices, use_edges ? &edges : NULL, mode, min_cycle_length, max_cycle_length

0 commit comments

Comments
 (0)