Skip to content

Commit

Permalink
free instead of unref (potential mem leak fix)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmorn committed Nov 10, 2023
1 parent 1ce15bf commit 3840cb9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions c_src/libav.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,12 +430,12 @@ ERL_NIF_TERM enif_audio_frame_unpack(ErlNifEnv *env, int argc,

void enif_free_packet(ErlNifEnv *env, void *res) {
AVPacket **packet = (AVPacket **)res;
av_packet_unref(*packet);
av_packet_free(packet);
}

void enif_free_frame(ErlNifEnv *env, void *res) {
AVFrame **frame = (AVFrame **)res;
av_frame_unref(*frame);
av_frame_free(frame);
}

// Called when the nif is loaded, as specified in the ERL_NIF_INIT call.
Expand Down

0 comments on commit 3840cb9

Please sign in to comment.