From: Rémi Bernon rbernon@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57204 --- dlls/winedmo/unix_demuxer.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/dlls/winedmo/unix_demuxer.c b/dlls/winedmo/unix_demuxer.c index 12fd998e7e4..6f3264f05bd 100644 --- a/dlls/winedmo/unix_demuxer.c +++ b/dlls/winedmo/unix_demuxer.c @@ -98,18 +98,12 @@ NTSTATUS demuxer_create( void *arg ) TRACE( "context %p, url %s, mime %s\n", params->context, debugstr_a(params->url), debugstr_a(params->mime_type) );
if (!(ctx = avformat_alloc_context())) return STATUS_NO_MEMORY; - if (!(ctx->pb = avio_alloc_context( NULL, 0, 0, params->context, unix_read_callback, NULL, unix_seek_callback ))) - { - avformat_free_context( ctx ); - return STATUS_NO_MEMORY; - } + if (!(ctx->pb = avio_alloc_context( NULL, 0, 0, params->context, unix_read_callback, NULL, unix_seek_callback ))) goto failed;
if ((ret = avformat_open_input( &ctx, NULL, NULL, NULL )) < 0) { ERR( "Failed to open input, error %s.\n", debugstr_averr(ret) ); - avio_context_free( &ctx->pb ); - avformat_free_context( ctx ); - return STATUS_UNSUCCESSFUL; + goto failed; } format = ctx->iformat;
@@ -117,10 +111,8 @@ NTSTATUS demuxer_create( void *arg ) { if ((ret = avformat_find_stream_info( ctx, NULL )) < 0) { - ERR( "Failed to find stream info, ret %d (%s).\n", ret, av_err2str(ret) ); - avio_context_free( &ctx->pb ); - avformat_free_context( ctx ); - return STATUS_UNSUCCESSFUL; + ERR( "Failed to find stream info, error %s.\n", debugstr_averr(ret) ); + goto failed; } params->duration = get_context_duration( ctx ); } @@ -145,6 +137,14 @@ NTSTATUS demuxer_create( void *arg ) }
return STATUS_SUCCESS; + +failed: + if (ctx) + { + avio_context_free( &ctx->pb ); + avformat_free_context( ctx ); + } + return STATUS_UNSUCCESSFUL; }
NTSTATUS demuxer_destroy( void *arg )