[FFmpeg-devel] [PATCH] lavfi: check av_strdup() return value

Clément Bœsch u at pkh.me
Tue Jan 6 10:48:37 CET 2015


On Tue, Jan 06, 2015 at 09:43:52AM +0000, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavfilter/af_amix.c | 2 ++
>  libavfilter/af_join.c | 2 ++
>  libavfilter/split.c   | 2 ++
>  3 files changed, 6 insertions(+)
> 
> diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
> index e40969f..fd9d135 100644
> --- a/libavfilter/af_amix.c
> +++ b/libavfilter/af_amix.c
> @@ -496,6 +496,8 @@ static av_cold int init(AVFilterContext *ctx)
>          snprintf(name, sizeof(name), "input%d", i);
>          pad.type           = AVMEDIA_TYPE_AUDIO;
>          pad.name           = av_strdup(name);
> +        if (!pad.name)
> +            return AVERROR(ENOMEM);
>          pad.filter_frame   = filter_frame;
>  
>          ff_insert_inpad(ctx, i, &pad);
> diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c
> index a1717c6..71a454b 100644
> --- a/libavfilter/af_join.c
> +++ b/libavfilter/af_join.c
> @@ -214,6 +214,8 @@ static av_cold int join_init(AVFilterContext *ctx)
>          snprintf(name, sizeof(name), "input%d", i);
>          pad.type           = AVMEDIA_TYPE_AUDIO;
>          pad.name           = av_strdup(name);
> +        if (!pad.name)
> +            return AVERROR(ENOMEM);
>          pad.filter_frame   = filter_frame;
>  
>          pad.needs_fifo = 1;
> diff --git a/libavfilter/split.c b/libavfilter/split.c
> index 6abd5ee..7353810 100644
> --- a/libavfilter/split.c
> +++ b/libavfilter/split.c
> @@ -52,6 +52,8 @@ static av_cold int split_init(AVFilterContext *ctx)
>          snprintf(name, sizeof(name), "output%d", i);
>          pad.type = ctx->filter->inputs[0].type;
>          pad.name = av_strdup(name);
> +        if (!pad.name)
> +            return AVERROR(ENOMEM);
>  
>          ff_insert_outpad(ctx, i, &pad);
>      }

Sure OK

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150106/ee88045a/attachment.asc>


More information about the ffmpeg-devel mailing list