Hi,

On Wed, Apr 27, 2011 at 3:29 PM, Ronald S. Bultje <[email protected]> wrote:
> ---
>  libavfilter/avfilter.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index 135b9ff..c71c046 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -587,7 +587,8 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter 
> *filter, const char *in
>     ret->av_class = &avfilter_class;
>     ret->filter   = filter;
>     ret->name     = inst_name ? av_strdup(inst_name) : NULL;
> -    ret->priv     = av_mallocz(filter->priv_size);
> +    if (filter->priv_size)
> +        ret->priv     = av_mallocz(filter->priv_size);

Ping. Ugly or not, we're allocating zero bytes of memory here.

My last try at convincing you crowd that this is relevant: we cannot
distinguish proper return values (NULL) from errors (NULL) if size=0.
The standard says so. If wanted I will also introduce a if
(!ret->priv) return AVERROR(ENOMEM); and add a nice comment that /*
this allocates the codec private data */ or something. More
importantly, I can't run fate on my mac because half of avfilter
breaks.

Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to