Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/5] fftools/ffmpeg_mux_init: Fix leak on error
@ 2023-07-22 19:09 Andreas Rheinhardt
  2023-07-22 19:11 ` [FFmpeg-devel] [PATCH 2/5] fftools/ffmpeg_opt: " Andreas Rheinhardt
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2023-07-22 19:09 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Fixes Coverity issue #1539098.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 fftools/ffmpeg_mux_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 86521417ec..0289cdabad 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -361,7 +361,7 @@ static int enc_stats_init(OutputStream *ost, EncStats *es, int pre,
 
         ret = GROW_ARRAY(es->components, es->nb_components);
         if (ret < 0)
-            return ret;
+            goto fail;
 
         c = &es->components[es->nb_components - 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] 6+ messages in thread

* [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; 6+ 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] 6+ 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; 6+ 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] 6+ 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; 6+ 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] 6+ 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; 6+ 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] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/5] fftools/ffmpeg_mux_init: Fix leak on error
@ 2023-07-23 10:06 Anton Khirnov
  0 siblings, 0 replies; 6+ messages in thread
From: Anton Khirnov @ 2023-07-23 10:06 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Andreas Rheinhardt

Patchset looks good.

Thanks,
-- 
Anton Khirnov
_______________________________________________
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] 6+ messages in thread

end of thread, other threads:[~2023-07-23 12:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [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
2023-07-23 10:06 [FFmpeg-devel] [PATCH 1/5] fftools/ffmpeg_mux_init: Fix leak on error Anton Khirnov

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git