[FFmpeg-devel] [PATCH 1/3] avformat/libquvi: fix error handling

Michael Niedermayer michaelni at gmx.at
Wed Apr 8 21:13:11 CEST 2015


On Wed, Apr 08, 2015 at 07:16:36PM +0200, Gilles Chanteperdrix wrote:
> avoid calling cleanup functions on uninitialized variables
> 
> Signed-off-by: Gilles Chanteperdrix <gilles.chanteperdrix at xenomai.org>
> ---
>  libavformat/libquvi.c | 41 +++++++++++++++++++++++++----------------
>  1 file changed, 25 insertions(+), 16 deletions(-)
> 
> diff --git a/libavformat/libquvi.c b/libavformat/libquvi.c
> index 7c5f7a2..e838b34 100644
> --- a/libavformat/libquvi.c
> +++ b/libavformat/libquvi.c
> @@ -63,28 +63,38 @@ static int libquvi_read_header(AVFormatContext *s)
>      char *media_url, *pagetitle;
>  
>      rc = quvi_init(&q);
> -    if (rc != QUVI_OK)
> -        goto quvi_fail;
> +    if (rc != QUVI_OK) {
> +	av_log(s, AV_LOG_ERROR, "%s\n", quvi_strerror(q, rc));
> +	return AVERROR_EXTERNAL;
> +    }

is quvi_strerror() thread safe ?

also tabs

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150408/75bdab8c/attachment.asc>


More information about the ffmpeg-devel mailing list