[FFmpeg-devel] [PATCH 10/11] libzvbi-teletextdec: dont ignore memory allocation error silently
Clément Bœsch
u at pkh.me
Sat Nov 9 00:26:57 CET 2013
On Thu, Oct 31, 2013 at 09:28:56PM +0100, Marton Balint wrote:
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
> libavcodec/libzvbi-teletextdec.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c
> index 4678d5f..2829363 100644
> --- a/libavcodec/libzvbi-teletextdec.c
> +++ b/libavcodec/libzvbi-teletextdec.c
> @@ -438,6 +438,8 @@ teletext_decode_frame(AVCodecContext *avctx,
> if (sub->rects) {
> sub->num_rects = 1;
> sub->rects[0] = ctx->pages->sub_rect;
> + } else {
> + ret = AVERROR(ENOMEM);
> }
> } else {
> av_log(avctx, AV_LOG_DEBUG, "sending empty sub\n");
> @@ -450,7 +452,8 @@ teletext_decode_frame(AVCodecContext *avctx,
> ctx->pages[i] = ctx->pages[i + 1];
> ctx->nb_pages--;
>
> - *data_size = 1;
> + if (ret >= 0)
> + *data_size = 1;
> } else
> *data_size = 0;
>
LGTM
Note: *data_size won't be set sometimes. I'm assuming this is not
problematic since decode functions initialize them to 0, but in that case
the else switch could be removed completely.
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131109/91f9143f/attachment.asc>
More information about the ffmpeg-devel
mailing list