Skip to content

Commit

Permalink
Initialise adj and free unconditionaly
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph-Edwards committed May 10, 2024
1 parent 554e11f commit 6c1ddc2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/digraphs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,8 @@ static Obj FLOYD_WARSHALL(Obj digraph,
bool copy,
bool diameter,
bool shortest) {
Int n, i, j, k, *dist, *adj;
Int n, i, j, k, *dist;
Int* adj = NULL;
Obj next, out, outi, val;

n = DigraphNrVertices(digraph);
Expand Down Expand Up @@ -1204,9 +1205,7 @@ static Obj FLOYD_WARSHALL(Obj digraph,
maximum = dist[i * n + j];
} else if (dist[i * n + j] == -1) {
free(dist);
if (copy) {
free(adj);
}
free(adj);

Check warning on line 1208 in src/digraphs.c

View check run for this annotation

Codecov / codecov/patch

src/digraphs.c#L1208

Added line #L1208 was not covered by tests
return Fail;
}
}
Expand Down

0 comments on commit 6c1ddc2

Please sign in to comment.