avcodec/wma(dec|enc): Fix memleaks upon allocation error
ff_wma_init() can fail without freeing everything it has allocated; so add the FF_CODEC_CAP_INIT_CLEANUP to the codecs using it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> (cherry picked from commit fcdb012a100b245890949b2d53cb7f042380787d)
This commit is contained in:
		
							parent
							
								
									c256491f96
								
							
						
					
					
						commit
						44f830e7f0
					
				| @ -980,6 +980,7 @@ AVCodec ff_wmav1_decoder = { | |||||||
|     .capabilities   = AV_CODEC_CAP_DR1, |     .capabilities   = AV_CODEC_CAP_DR1, | ||||||
|     .sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, |     .sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, | ||||||
|                                                       AV_SAMPLE_FMT_NONE }, |                                                       AV_SAMPLE_FMT_NONE }, | ||||||
|  |     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP, | ||||||
| }; | }; | ||||||
| #endif | #endif | ||||||
| #if CONFIG_WMAV2_DECODER | #if CONFIG_WMAV2_DECODER | ||||||
| @ -996,5 +997,6 @@ AVCodec ff_wmav2_decoder = { | |||||||
|     .capabilities   = AV_CODEC_CAP_DR1, |     .capabilities   = AV_CODEC_CAP_DR1, | ||||||
|     .sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, |     .sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, | ||||||
|                                                       AV_SAMPLE_FMT_NONE }, |                                                       AV_SAMPLE_FMT_NONE }, | ||||||
|  |     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP, | ||||||
| }; | }; | ||||||
| #endif | #endif | ||||||
|  | |||||||
| @ -436,6 +436,7 @@ AVCodec ff_wmav1_encoder = { | |||||||
|     .close          = ff_wma_end, |     .close          = ff_wma_end, | ||||||
|     .sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, |     .sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, | ||||||
|                                                       AV_SAMPLE_FMT_NONE }, |                                                       AV_SAMPLE_FMT_NONE }, | ||||||
|  |     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP, | ||||||
| }; | }; | ||||||
| #endif | #endif | ||||||
| #if CONFIG_WMAV2_ENCODER | #if CONFIG_WMAV2_ENCODER | ||||||
| @ -450,5 +451,6 @@ AVCodec ff_wmav2_encoder = { | |||||||
|     .close          = ff_wma_end, |     .close          = ff_wma_end, | ||||||
|     .sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, |     .sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, | ||||||
|                                                       AV_SAMPLE_FMT_NONE }, |                                                       AV_SAMPLE_FMT_NONE }, | ||||||
|  |     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP, | ||||||
| }; | }; | ||||||
| #endif | #endif | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user