mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-11 17:30:00 +01:00
avcodec/tests/avpacket: Add av_packet_free() to avoid memory leak
Add av_packet_free() to free avpkt_clone and avpkt in the error paths to avoid potential memory leak. Fixes:da3c69a5a9("Added test for libavcodec/avpacket.c") Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commitab040e2565) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
Michael Niedermayer
parent
bd71559373
commit
78dfb98f7d
@@ -100,11 +100,14 @@ int main(void)
|
|||||||
|
|
||||||
if(!avpkt_clone) {
|
if(!avpkt_clone) {
|
||||||
av_log(NULL, AV_LOG_ERROR,"av_packet_clone failed to clone AVPacket\n");
|
av_log(NULL, AV_LOG_ERROR,"av_packet_clone failed to clone AVPacket\n");
|
||||||
|
av_packet_free(&avpkt);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*test av_grow_packet*/
|
/*test av_grow_packet*/
|
||||||
if(av_grow_packet(avpkt_clone, 20) < 0){
|
if(av_grow_packet(avpkt_clone, 20) < 0){
|
||||||
av_log(NULL, AV_LOG_ERROR, "av_grow_packet failed\n");
|
av_log(NULL, AV_LOG_ERROR, "av_grow_packet failed\n");
|
||||||
|
av_packet_free(&avpkt_clone);
|
||||||
|
av_packet_free(&avpkt);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(av_grow_packet(avpkt_clone, INT_MAX) == 0){
|
if(av_grow_packet(avpkt_clone, INT_MAX) == 0){
|
||||||
|
|||||||
Reference in New Issue
Block a user