From 3840cb99b70915112f3800fa843d2ac9b88507ed Mon Sep 17 00:00:00 2001 From: Daniel Morandini Date: Fri, 10 Nov 2023 17:54:04 +0100 Subject: [PATCH] free instead of unref (potential mem leak fix) --- c_src/libav.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/c_src/libav.c b/c_src/libav.c index 5910b4b..2e6ce34 100644 --- a/c_src/libav.c +++ b/c_src/libav.c @@ -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.