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 e945315 commit 8efb46a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/super_glue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,16 @@ bool SuperGlue::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 8efb46a

Please sign in to comment.