Skip to content

Commit

Permalink
Fix code scanning alert - Returning stack-allocated memory bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ItaloCobains committed Nov 14, 2023
1 parent 0dfffd8 commit 1f40367
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 1f40367

Please sign in to comment.