fftools/cmdutils: Avoid crash when opts could not be allocated
If 'opts' could not be allocated, exiting the program to avoid crash when release it. Reported-by: TOTE Robot <oslab@tsinghua.edu.cn> Signed-off-by: Yu Yang <yuyang14@kuaishou.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
		
							parent
							
								
									3f46ffe956
								
							
						
					
					
						commit
						a4580bf959
					
				| @ -2187,7 +2187,7 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, | |||||||
|     if (!opts) { |     if (!opts) { | ||||||
|         av_log(NULL, AV_LOG_ERROR, |         av_log(NULL, AV_LOG_ERROR, | ||||||
|                "Could not alloc memory for stream options.\n"); |                "Could not alloc memory for stream options.\n"); | ||||||
|         return NULL; |         exit_program(1); | ||||||
|     } |     } | ||||||
|     for (i = 0; i < s->nb_streams; i++) |     for (i = 0; i < s->nb_streams; i++) | ||||||
|         opts[i] = filter_codec_opts(codec_opts, s->streams[i]->codecpar->codec_id, |         opts[i] = filter_codec_opts(codec_opts, s->streams[i]->codecpar->codec_id, | ||||||
|  | |||||||
| @ -430,8 +430,8 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, | |||||||
|  * Each dictionary will contain the options from codec_opts which can |  * Each dictionary will contain the options from codec_opts which can | ||||||
|  * be applied to the corresponding stream codec context. |  * be applied to the corresponding stream codec context. | ||||||
|  * |  * | ||||||
|  * @return pointer to the created array of dictionaries, NULL if it |  * @return pointer to the created array of dictionaries. | ||||||
|  * cannot be created |  * Calls exit() on failure. | ||||||
|  */ |  */ | ||||||
| AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, | AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, | ||||||
|                                            AVDictionary *codec_opts); |                                            AVDictionary *codec_opts); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user