Hi,

On Tue, Jul 12, 2011 at 1:47 PM, Anton Khirnov <[email protected]> wrote:
> ic is NULL in case of error.
> ---
>  libavformat/utils.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index bbd1b2d..cf63e2e 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -467,7 +467,8 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
>         ic->pb = pb;
>
>     err = avformat_open_input(&ic, filename, fmt, &opts);
> -    ic->pb = ic->pb ? ic->pb : pb; // don't leak custom pb if it wasn't set 
> above
> +    if (err >= 0)
> +        ic->pb = ic->pb ? ic->pb : pb; // don't leak custom pb if it wasn't 
> set above
>
>     *ic_ptr = ic;
>  fail:

How about if (err) goto fail?

But this is fine also.

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

Reply via email to