Skip to content

Commit

Permalink
fixed memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
yuefanhao authored Nov 10, 2023
1 parent 8efb46a commit b6ef70f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/super_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,16 @@ bool SuperPoint::deserialize_engine() {
file.read(model_stream, size);
file.close();
IRuntime *runtime = createInferRuntime(gLogger);
if (runtime == nullptr) return false;
if (runtime == nullptr) {
delete [] model_stream;
return false;
}
engine_ = std::shared_ptr<nvinfer1::ICudaEngine>(runtime->deserializeCudaEngine(model_stream, size));
if (engine_ == nullptr) return false;
if (engine_ == nullptr) {
delete [] model_stream;
return false;
}
delete [] model_stream;
return true;
}
return false;
Expand Down

0 comments on commit b6ef70f

Please sign in to comment.