mirror of
				https://github.com/nyanmisaka/ffmpeg-rockchip.git
				synced 2025-11-01 04:53:04 +08:00 
			
		
		
		
	avcodec/mationpixels: free memory after malloc failures
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
		 Piotr Bandurski
					Piotr Bandurski
				
			
				
					committed by
					
						 Michael Niedermayer
						Michael Niedermayer
					
				
			
			
				
	
			
			
			 Michael Niedermayer
						Michael Niedermayer
					
				
			
						parent
						
							7d8939a0ff
						
					
				
				
					commit
					bb5e7d3b5a
				
			| @@ -68,8 +68,12 @@ static av_cold int mp_decode_init(AVCodecContext *avctx) | ||||
|     mp->offset_bits_len = av_log2(avctx->width * avctx->height) + 1; | ||||
|     mp->vpt = av_mallocz(avctx->height * sizeof(YuvPixel)); | ||||
|     mp->hpt = av_mallocz(h4 * w4 / 16 * sizeof(YuvPixel)); | ||||
|     if (!mp->changes_map || !mp->vpt || !mp->hpt) | ||||
|     if (!mp->changes_map || !mp->vpt || !mp->hpt) { | ||||
|         av_freep(&mp->changes_map); | ||||
|         av_freep(&mp->vpt); | ||||
|         av_freep(&mp->hpt); | ||||
|         return AVERROR(ENOMEM); | ||||
|     } | ||||
|     avctx->pix_fmt = AV_PIX_FMT_RGB555; | ||||
|     avcodec_get_frame_defaults(&mp->frame); | ||||
|     return 0; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user