Skip to content

Commit

Permalink
Merge pull request #2 from ItaloCobains/1-fix-code-scanning-alert-ret…
Browse files Browse the repository at this point in the history
…urning-stack-allocated-memory

Fix code scanning alert - Returning stack-allocated memory bug
  • Loading branch information
ItaloCobains authored Nov 14, 2023
2 parents 0dfffd8 + 1f40367 commit b127be1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@italocobains/graph",
"version": "1.1.8",
"version": "1.1.9",
"description": "This is a lib write by c++ and nodejs addon api for graph algorithm.",
"main": "index.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion src/graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ Edge *Graph::getEdge(int sourceId, int targetId) const
{
if (edge.sourceId == sourceId && edge.targetId == targetId)
{
return &edge;
Edge *edgeCopy = new Edge(edge);
return edgeCopy;
}
}
return nullptr;
Expand Down

0 comments on commit b127be1

Please sign in to comment.