avcodec/mjpegdec: Fix memleak upon init failure
This affected all decoders that used ff_mjpeg_decode_init() as init function; and it also affected decoders that open jpeg decoders via ff_codec_open2_recursive() as well as MxPEG. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> (cherry picked from commit f3e645a7967d64df8a19c4e0eea93f17937913fb)
This commit is contained in:
		
							parent
							
								
									4ec5d6896d
								
							
						
					
					
						commit
						eda1ed6f91
					
				| @ -553,5 +553,5 @@ AVCodec ff_jpegls_decoder = { | |||||||
|     .close          = ff_mjpeg_decode_end, |     .close          = ff_mjpeg_decode_end, | ||||||
|     .decode         = ff_mjpeg_decode_frame, |     .decode         = ff_mjpeg_decode_frame, | ||||||
|     .capabilities   = AV_CODEC_CAP_DR1, |     .capabilities   = AV_CODEC_CAP_DR1, | ||||||
|     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE, |     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, | ||||||
| }; | }; | ||||||
|  | |||||||
| @ -163,5 +163,5 @@ AVCodec ff_mjpegb_decoder = { | |||||||
|     .decode         = mjpegb_decode_frame, |     .decode         = mjpegb_decode_frame, | ||||||
|     .capabilities   = AV_CODEC_CAP_DR1, |     .capabilities   = AV_CODEC_CAP_DR1, | ||||||
|     .max_lowres     = 3, |     .max_lowres     = 3, | ||||||
|     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE, |     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, | ||||||
| }; | }; | ||||||
|  | |||||||
| @ -2876,7 +2876,7 @@ AVCodec ff_mjpeg_decoder = { | |||||||
|     .max_lowres     = 3, |     .max_lowres     = 3, | ||||||
|     .priv_class     = &mjpegdec_class, |     .priv_class     = &mjpegdec_class, | ||||||
|     .profiles       = NULL_IF_CONFIG_SMALL(ff_mjpeg_profiles), |     .profiles       = NULL_IF_CONFIG_SMALL(ff_mjpeg_profiles), | ||||||
|     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | |     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP | | ||||||
|                       FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, |                       FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, | ||||||
|     .hw_configs     = (const AVCodecHWConfigInternal*[]) { |     .hw_configs     = (const AVCodecHWConfigInternal*[]) { | ||||||
| #if CONFIG_MJPEG_NVDEC_HWACCEL | #if CONFIG_MJPEG_NVDEC_HWACCEL | ||||||
| @ -2902,6 +2902,6 @@ AVCodec ff_thp_decoder = { | |||||||
|     .flush          = decode_flush, |     .flush          = decode_flush, | ||||||
|     .capabilities   = AV_CODEC_CAP_DR1, |     .capabilities   = AV_CODEC_CAP_DR1, | ||||||
|     .max_lowres     = 3, |     .max_lowres     = 3, | ||||||
|     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE, |     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, | ||||||
| }; | }; | ||||||
| #endif | #endif | ||||||
|  | |||||||
| @ -106,7 +106,7 @@ AVCodec ff_sp5x_decoder = { | |||||||
|     .decode         = sp5x_decode_frame, |     .decode         = sp5x_decode_frame, | ||||||
|     .capabilities   = AV_CODEC_CAP_DR1, |     .capabilities   = AV_CODEC_CAP_DR1, | ||||||
|     .max_lowres     = 3, |     .max_lowres     = 3, | ||||||
|     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE, |     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, | ||||||
| }; | }; | ||||||
| #endif | #endif | ||||||
| #if CONFIG_AMV_DECODER | #if CONFIG_AMV_DECODER | ||||||
| @ -121,6 +121,6 @@ AVCodec ff_amv_decoder = { | |||||||
|     .decode         = sp5x_decode_frame, |     .decode         = sp5x_decode_frame, | ||||||
|     .max_lowres     = 3, |     .max_lowres     = 3, | ||||||
|     .capabilities   = AV_CODEC_CAP_DR1, |     .capabilities   = AV_CODEC_CAP_DR1, | ||||||
|     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE, |     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, | ||||||
| }; | }; | ||||||
| #endif | #endif | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user