aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2015-10-22 18:00:40 -0400
committerRonald S. Bultje <rsbultje@gmail.com>2015-10-23 06:38:30 -0400
commit0c7b44a01c1564ef681d51a5ed37d3908558143b (patch)
treef286931eb3a0d801f2d227568384506f1849b47b /libavfilter
parenta60539bb5e30d899c45c6ea9079f5b7669539f7a (diff)
downloadffmpeg-0c7b44a01c1564ef681d51a5ed37d3908558143b.tar.gz
vf_psnr/ssim: don't crash if stats_file is NULL.
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_psnr.c24
-rw-r--r--libavfilter/vf_ssim.c24
2 files changed, 26 insertions, 22 deletions
diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c
index ca419396ba..36bbab259f 100644
--- a/libavfilter/vf_psnr.c
+++ b/libavfilter/vf_psnr.c
@@ -193,17 +193,19 @@ static av_cold int init(AVFilterContext *ctx)
s->min_mse = +INFINITY;
s->max_mse = -INFINITY;
- if (!strcmp(s->stats_file_str, "-")) {
- s->stats_file = stdout;
- } else if (s->stats_file_str) {
- s->stats_file = fopen(s->stats_file_str, "w");
- if (!s->stats_file) {
- int err = AVERROR(errno);
- char buf[128];
- av_strerror(err, buf, sizeof(buf));
- av_log(ctx, AV_LOG_ERROR, "Could not open stats file %s: %s\n",
- s->stats_file_str, buf);
- return err;
+ if (s->stats_file_str) {
+ if (!strcmp(s->stats_file_str, "-")) {
+ s->stats_file = stdout;
+ } else {
+ s->stats_file = fopen(s->stats_file_str, "w");
+ if (!s->stats_file) {
+ int err = AVERROR(errno);
+ char buf[128];
+ av_strerror(err, buf, sizeof(buf));
+ av_log(ctx, AV_LOG_ERROR, "Could not open stats file %s: %s\n",
+ s->stats_file_str, buf);
+ return err;
+ }
}
}
diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c
index 4dc96a73fb..ce1e3db98e 100644
--- a/libavfilter/vf_ssim.c
+++ b/libavfilter/vf_ssim.c
@@ -223,17 +223,19 @@ static av_cold int init(AVFilterContext *ctx)
{
SSIMContext *s = ctx->priv;
- if (!strcmp(s->stats_file_str, "-")) {
- s->stats_file = stdout;
- } else if (s->stats_file_str) {
- s->stats_file = fopen(s->stats_file_str, "w");
- if (!s->stats_file) {
- int err = AVERROR(errno);
- char buf[128];
- av_strerror(err, buf, sizeof(buf));
- av_log(ctx, AV_LOG_ERROR, "Could not open stats file %s: %s\n",
- s->stats_file_str, buf);
- return err;
+ if (s->stats_file_str) {
+ if (!strcmp(s->stats_file_str, "-")) {
+ s->stats_file = stdout;
+ } else {
+ s->stats_file = fopen(s->stats_file_str, "w");
+ if (!s->stats_file) {
+ int err = AVERROR(errno);
+ char buf[128];
+ av_strerror(err, buf, sizeof(buf));
+ av_log(ctx, AV_LOG_ERROR, "Could not open stats file %s: %s\n",
+ s->stats_file_str, buf);
+ return err;
+ }
}
}