Skip to content

Commit

Permalink
fix instance norm double free (#1749)
Browse files Browse the repository at this point in the history
  • Loading branch information
grimoire authored and lvhan028 committed Mar 1, 2023
1 parent 54efa37 commit ae9f6bf
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,18 @@ void TRTInstanceNormalization::attachToContext(cudnnContext* cudnnContext,

// Detach the plugin object from its execution context.
void TRTInstanceNormalization::detachFromContext() TRT_NOEXCEPT {
cudnnDestroyTensorDescriptor(_y_desc);
cudnnDestroyTensorDescriptor(_x_desc);
cudnnDestroyTensorDescriptor(_b_desc);
if (_y_desc) {
cudnnDestroyTensorDescriptor(_y_desc);
_y_desc = nullptr;
}
if (_x_desc) {
cudnnDestroyTensorDescriptor(_x_desc);
_x_desc = nullptr;
}
if (_b_desc) {
cudnnDestroyTensorDescriptor(_b_desc);
_b_desc = nullptr;
}
}

void TRTInstanceNormalization::configurePlugin(const nvinfer1::DynamicPluginTensorDesc* in,
Expand Down

0 comments on commit ae9f6bf

Please sign in to comment.