Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
b04e2c5d by Hugo Beauzée-Luyssen at 2021-11-16T14:01:27+00:00
avcodec: encoder: Fix leak on error

- - - - -
ecdd9957 by Hugo Beauzée-Luyssen at 2021-11-16T14:01:27+00:00
avcodec: encoder: Don't unref frame twice

The frame is unref'ed in the callsite

- - - - -
c2549ced by Hugo Beauzée-Luyssen at 2021-11-16T14:01:27+00:00
muxer: avformat: Add missing av_packet_free

- - - - -


2 changed files:

- modules/codec/avcodec/encoder.c
- modules/demux/avformat/mux.c


Changes:

=====================================
modules/codec/avcodec/encoder.c
=====================================
@@ -1173,15 +1173,13 @@ static block_t *encode_avframe( encoder_t *p_enc, 
encoder_sys_t *p_sys, AVFrame
     AVPacket *av_pkt = av_packet_alloc();
 
     if( !av_pkt )
-    {
-        av_frame_unref( frame );
         return NULL;
-    }
 
     int ret = avcodec_send_frame( p_sys->p_context, frame );
     if( frame && ret != 0 && ret != AVERROR(EAGAIN) )
     {
         msg_Warn( p_enc, "cannot send one frame to encoder %d", ret );
+        av_packet_free( &av_pkt );
         return NULL;
     }
     ret = avcodec_receive_packet( p_sys->p_context, av_pkt );


=====================================
modules/demux/avformat/mux.c
=====================================
@@ -413,12 +413,12 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t 
*p_input )
                  "(pkt pts: %"PRId64", dts: %"PRId64")",
                  p_data->i_pts, p_data->i_dts, pkt->pts, pkt->dts );
         block_Release( p_data );
-        av_packet_unref( pkt );
+        av_packet_free( &pkt );
         return VLC_EGENERIC;
     }
 
 
-    av_packet_unref( pkt );
+    av_packet_free( &pkt );
     block_Release( p_data );
     return VLC_SUCCESS;
 }



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/60456133bd8a456fb836875ed5ecaaeb94c3a2ab...c2549ced70d5a6c56fd2411519b185b4a04c36d2

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/60456133bd8a456fb836875ed5ecaaeb94c3a2ab...c2549ced70d5a6c56fd2411519b185b4a04c36d2
You're receiving this email because of your account on code.videolan.org.


_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to