Skip to content

Commit

Permalink
chore: fix destructor
Browse files Browse the repository at this point in the history
  • Loading branch information
vladfrangu committed Jul 10, 2024
1 parent 402a8ab commit 22e48cd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/node-opus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Object OpusEncoder::Init(Napi::Env env, Object exports) {
OpusEncoder::OpusEncoder(const CallbackInfo& args): ObjectWrap<OpusEncoder>(args) {
this->encoder = nullptr;
this->decoder = nullptr;
this->outPcm = nullptr;

if (args.Length() < 2) {
Napi::RangeError::New(args.Env(), "Expected 2 arguments").ThrowAsJavaScriptException();
Expand All @@ -68,7 +69,7 @@ OpusEncoder::~OpusEncoder() {
this->encoder = nullptr;
this->decoder = nullptr;

delete this->outPcm;
if (this->outPcm) delete this->outPcm;
this->outPcm = nullptr;
}

Expand Down

0 comments on commit 22e48cd

Please sign in to comment.