* [FFmpeg-devel] [PATCH 2/5] fftools/ffmpeg_opt: Fix leak on error
2023-07-22 19:09 [FFmpeg-devel] [PATCH 1/5] fftools/ffmpeg_mux_init: Fix leak on error Andreas Rheinhardt
@ 2023-07-22 19:11 ` Andreas Rheinhardt
2023-07-22 19:11 ` [FFmpeg-devel] [PATCH 3/5] fftools/opt_common: " Andreas Rheinhardt
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Andreas Rheinhardt @ 2023-07-22 19:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Fixes Coverity issue #1539097.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
fftools/ffmpeg_opt.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 700db706a1..f7606ae6f6 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -497,7 +497,7 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg)
ret = GROW_ARRAY(o->audio_channel_maps, o->nb_audio_channel_maps);
if (ret < 0)
- return ret;
+ goto end;
m = &o->audio_channel_maps[o->nb_audio_channel_maps - 1];
@@ -559,11 +559,13 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg)
}
}
+ ret = 0;
+end:
av_free(mapchan);
- return 0;
+ return ret;
fail:
- av_free(mapchan);
- return AVERROR(EINVAL);
+ ret = AVERROR(EINVAL);
+ goto end;
}
#endif
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* [FFmpeg-devel] [PATCH 3/5] fftools/opt_common: Fix leak on error
2023-07-22 19:09 [FFmpeg-devel] [PATCH 1/5] fftools/ffmpeg_mux_init: Fix leak on error Andreas Rheinhardt
2023-07-22 19:11 ` [FFmpeg-devel] [PATCH 2/5] fftools/ffmpeg_opt: " Andreas Rheinhardt
@ 2023-07-22 19:11 ` Andreas Rheinhardt
2023-07-22 19:11 ` [FFmpeg-devel] [PATCH 4/5] fftools/ffmpeg_opt: " Andreas Rheinhardt
2023-07-22 19:11 ` [FFmpeg-devel] [PATCH 5/5] fftools/ffmpeg_opt: Reduce scope of variables for deprecated code Andreas Rheinhardt
3 siblings, 0 replies; 5+ messages in thread
From: Andreas Rheinhardt @ 2023-07-22 19:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Fixes Coverity issue #743443.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
fftools/opt_common.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index 913932c914..7c996f140d 100644
--- a/fftools/opt_common.c
+++ b/fftools/opt_common.c
@@ -1165,6 +1165,7 @@ int init_report(const char *env, FILE **file)
av_log(NULL, AV_LOG_FATAL, "Invalid report file level\n");
av_free(key);
av_free(val);
+ av_free(filename_template);
return AVERROR(EINVAL);
}
envlevel = 1;
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* [FFmpeg-devel] [PATCH 4/5] fftools/ffmpeg_opt: Fix leak on error
2023-07-22 19:09 [FFmpeg-devel] [PATCH 1/5] fftools/ffmpeg_mux_init: Fix leak on error Andreas Rheinhardt
2023-07-22 19:11 ` [FFmpeg-devel] [PATCH 2/5] fftools/ffmpeg_opt: " Andreas Rheinhardt
2023-07-22 19:11 ` [FFmpeg-devel] [PATCH 3/5] fftools/opt_common: " Andreas Rheinhardt
@ 2023-07-22 19:11 ` Andreas Rheinhardt
2023-07-22 19:11 ` [FFmpeg-devel] [PATCH 5/5] fftools/ffmpeg_opt: Reduce scope of variables for deprecated code Andreas Rheinhardt
3 siblings, 0 replies; 5+ messages in thread
From: Andreas Rheinhardt @ 2023-07-22 19:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Fixes Coverity id #1539096.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
fftools/ffmpeg_opt.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index f7606ae6f6..1860e9d329 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -401,13 +401,14 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
ret = GROW_ARRAY(o->stream_maps, o->nb_stream_maps);
if (ret < 0)
- return ret;
+ goto fail;
m = &o->stream_maps[o->nb_stream_maps - 1];
m->linklabel = av_get_token(&c, "]");
if (!m->linklabel) {
av_log(NULL, AV_LOG_ERROR, "Invalid output link label: %s.\n", map);
- return AVERROR(EINVAL);
+ ret = AVERROR(EINVAL);
+ goto fail;
}
} else {
if (allow_unused = strchr(map, '?'))
@@ -415,7 +416,8 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
file_idx = strtol(map, &p, 0);
if (file_idx >= nb_input_files || file_idx < 0) {
av_log(NULL, AV_LOG_FATAL, "Invalid input file index: %d.\n", file_idx);
- return AVERROR(EINVAL);
+ ret = AVERROR(EINVAL);
+ goto fail;
}
if (negative)
/* disable some already defined maps */
@@ -438,7 +440,7 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
}
ret = GROW_ARRAY(o->stream_maps, o->nb_stream_maps);
if (ret < 0)
- return ret;
+ goto fail;
m = &o->stream_maps[o->nb_stream_maps - 1];
@@ -453,16 +455,19 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
} else if (disabled) {
av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches disabled streams.\n"
"To ignore this, add a trailing '?' to the map.\n", arg);
- return AVERROR(EINVAL);
+ ret = AVERROR(EINVAL);
+ goto fail;
} else {
av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches no streams.\n"
"To ignore this, add a trailing '?' to the map.\n", arg);
- return AVERROR(EINVAL);
+ ret = AVERROR(EINVAL);
+ goto fail;
}
}
-
+ ret = 0;
+fail:
av_freep(&map);
- return 0;
+ return ret;
}
static int opt_attach(void *optctx, const char *opt, const char *arg)
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* [FFmpeg-devel] [PATCH 5/5] fftools/ffmpeg_opt: Reduce scope of variables for deprecated code
2023-07-22 19:09 [FFmpeg-devel] [PATCH 1/5] fftools/ffmpeg_mux_init: Fix leak on error Andreas Rheinhardt
` (2 preceding siblings ...)
2023-07-22 19:11 ` [FFmpeg-devel] [PATCH 4/5] fftools/ffmpeg_opt: " Andreas Rheinhardt
@ 2023-07-22 19:11 ` Andreas Rheinhardt
3 siblings, 0 replies; 5+ messages in thread
From: Andreas Rheinhardt @ 2023-07-22 19:11 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
fftools/ffmpeg_opt.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 1860e9d329..dc6044120a 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -372,9 +372,6 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
StreamMap *m = NULL;
int i, negative = 0, file_idx, disabled = 0;
int ret;
-#if FFMPEG_OPT_MAP_SYNC
- char *sync;
-#endif
char *map, *p;
char *allow_unused;
@@ -387,10 +384,14 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
return AVERROR(ENOMEM);
#if FFMPEG_OPT_MAP_SYNC
- /* parse sync stream first, just pick first matching stream */
- if (sync = strchr(map, ',')) {
- *sync = 0;
- av_log(NULL, AV_LOG_WARNING, "Specifying a sync stream is deprecated and has no effect\n");
+ {
+ /* parse sync stream first, just pick first matching stream */
+ char *sync = strchr(map, ',');
+
+ if (sync) {
+ *sync = 0;
+ av_log(NULL, AV_LOG_WARNING, "Specifying a sync stream is deprecated and has no effect\n");
+ }
}
#endif
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread