aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@gmail.com>2012-12-06 02:32:47 -0200
committerMichael Niedermayer <michaelni@gmx.at>2012-12-08 21:44:30 +0100
commitf2c49da9ac486597a240cf62d23b8a85eb6fe6e9 (patch)
tree913d914185a39342485956f66a8a7654ad009812
parent129d73715084620f52dd507aeab29eb8e1da490e (diff)
downloadffmpeg-f2c49da9ac486597a240cf62d23b8a85eb6fe6e9.tar.gz
dshow: fix return code when opening device
Successfully opening a device altered the ret variable, making the function not cleanup properly and return an incorrect value for errors that happened afterwards. Reviewed-by: Stefano Sabatini <stefasab@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavdevice/dshow.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index ea01b2a30f..9485af6586 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -929,20 +929,18 @@ static int dshow_read_header(AVFormatContext *avctx)
}
if (ctx->device_name[VideoDevice]) {
- ret = dshow_open_device(avctx, devenum, VideoDevice);
- if (ret < 0)
- goto error;
- ret = dshow_add_device(avctx, VideoDevice);
- if (ret < 0)
+ if ((r = dshow_open_device(avctx, devenum, VideoDevice)) < 0 ||
+ (r = dshow_add_device(avctx, VideoDevice)) < 0) {
+ ret = r;
goto error;
+ }
}
if (ctx->device_name[AudioDevice]) {
- ret = dshow_open_device(avctx, devenum, AudioDevice);
- if (ret < 0)
- goto error;
- ret = dshow_add_device(avctx, AudioDevice);
- if (ret < 0)
+ if ((r = dshow_open_device(avctx, devenum, AudioDevice)) < 0 ||
+ (r = dshow_add_device(avctx, AudioDevice)) < 0) {
+ ret = r;
goto error;
+ }
}
ctx->mutex = CreateMutex(NULL, 0, NULL);