mirror of
				https://github.com/nyanmisaka/ffmpeg-rockchip.git
				synced 2025-10-31 12:36:41 +08:00 
			
		
		
		
	avfilter/vf_libopencv: fix resource leak in read_shape_frame_filter
CID: 1324298 add a label when error goto the label to release resource Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
This commit is contained in:
		| @@ -157,7 +157,8 @@ static int read_shape_from_file(int *cols, int *rows, int **values, const char * | |||||||
|         if (buf[i] == '\n') { |         if (buf[i] == '\n') { | ||||||
|             if (*rows == INT_MAX) { |             if (*rows == INT_MAX) { | ||||||
|                 av_log(log_ctx, AV_LOG_ERROR, "Overflow on the number of rows in the file\n"); |                 av_log(log_ctx, AV_LOG_ERROR, "Overflow on the number of rows in the file\n"); | ||||||
|                 return AVERROR_INVALIDDATA; |                 ret = AVERROR_INVALIDDATA; | ||||||
|  |                 goto end; | ||||||
|             } |             } | ||||||
|             ++(*rows); |             ++(*rows); | ||||||
|             *cols = FFMAX(*cols, w); |             *cols = FFMAX(*cols, w); | ||||||
| @@ -171,10 +172,13 @@ static int read_shape_from_file(int *cols, int *rows, int **values, const char * | |||||||
|     if (*rows > (SIZE_MAX / sizeof(int) / *cols)) { |     if (*rows > (SIZE_MAX / sizeof(int) / *cols)) { | ||||||
|         av_log(log_ctx, AV_LOG_ERROR, "File with size %dx%d is too big\n", |         av_log(log_ctx, AV_LOG_ERROR, "File with size %dx%d is too big\n", | ||||||
|                *rows, *cols); |                *rows, *cols); | ||||||
|         return AVERROR_INVALIDDATA; |         ret = AVERROR_INVALIDDATA; | ||||||
|  |         goto end; | ||||||
|  |     } | ||||||
|  |     if (!(*values = av_mallocz_array(sizeof(int) * *rows, *cols))) { | ||||||
|  |         ret = AVERROR(ENOMEM); | ||||||
|  |         goto end; | ||||||
|     } |     } | ||||||
|     if (!(*values = av_mallocz_array(sizeof(int) * *rows, *cols))) |  | ||||||
|         return AVERROR(ENOMEM); |  | ||||||
|  |  | ||||||
|     /* fill *values */ |     /* fill *values */ | ||||||
|     p    = buf; |     p    = buf; | ||||||
| @@ -188,6 +192,8 @@ static int read_shape_from_file(int *cols, int *rows, int **values, const char * | |||||||
|                 (*values)[*cols*i + j] = !!av_isgraph(*(p++)); |                 (*values)[*cols*i + j] = !!av_isgraph(*(p++)); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | end: | ||||||
|     av_file_unmap(buf, size); |     av_file_unmap(buf, size); | ||||||
|  |  | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Steven Liu
					Steven Liu