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 0/5] Graphprint and Mermaid Fixes
@ 2025-05-20  2:04 ffmpegagent
  2025-05-20  2:05 ` [FFmpeg-devel] [PATCH 1/5] fftools/makefile: Remove resources from ffprobe softworkz
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ffmpegagent @ 2025-05-20  2:04 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: softworkz

This patchsets includes

 * two minor fixes for resource compilation
 * fixes for memory leaks in graphprint and tf_mermaid

softworkz (5):
  fftools/makefile: Remove resources from ffprobe
  fftools/resources: Use .SECONDARY in Makefile comment
  fftools/ffmpeg: Free print_graph option variables
  fftools/graphprint: Fix memory leaks
  fftools/tf_mermaid: Add missing uninit and fix leaks

 fftools/Makefile                |  1 -
 fftools/ffmpeg.c                |  3 +++
 fftools/graph/graphprint.c      |  5 +++-
 fftools/resources/Makefile      |  2 +-
 fftools/textformat/tf_mermaid.c | 45 +++++++++++++++++++++++++++------
 5 files changed, 45 insertions(+), 11 deletions(-)


base-commit: fd18ae88ae736b5aabff34e17394fcd103f9e5ad
Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-84%2Fsoftworkz%2Fsubmit_graphprint_fixes-v1
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-84/softworkz/submit_graphprint_fixes-v1
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/84
-- 
ffmpeg-codebot
_______________________________________________
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 1/5] fftools/makefile: Remove resources from ffprobe
  2025-05-20  2:04 [FFmpeg-devel] [PATCH 0/5] Graphprint and Mermaid Fixes ffmpegagent
@ 2025-05-20  2:05 ` softworkz
  2025-05-20  2:05 ` [FFmpeg-devel] [PATCH 2/5] fftools/resources: Use .SECONDARY in Makefile comment softworkz
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: softworkz @ 2025-05-20  2:05 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: softworkz

From: softworkz <softworkz@hotmail.com>

Even though it doesn't have any effect, that line is not needed (yet).

Signed-off-by: softworkz <softworkz@hotmail.com>
---
 fftools/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fftools/Makefile b/fftools/Makefile
index 361a4fd574..c1eba733da 100644
--- a/fftools/Makefile
+++ b/fftools/Makefile
@@ -49,7 +49,6 @@ OBJS-ffprobe +=                       \
     fftools/textformat/tw_avio.o      \
     fftools/textformat/tw_buffer.o    \
     fftools/textformat/tw_stdout.o    \
-    $(OBJS-resman)                    \
 
 OBJS-ffplay += fftools/ffplay_renderer.o
 
-- 
ffmpeg-codebot

_______________________________________________
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/resources: Use .SECONDARY in Makefile comment
  2025-05-20  2:04 [FFmpeg-devel] [PATCH 0/5] Graphprint and Mermaid Fixes ffmpegagent
  2025-05-20  2:05 ` [FFmpeg-devel] [PATCH 1/5] fftools/makefile: Remove resources from ffprobe softworkz
@ 2025-05-20  2:05 ` softworkz
  2025-05-20  2:05 ` [FFmpeg-devel] [PATCH 3/5] fftools/ffmpeg: Free print_graph option variables softworkz
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: softworkz @ 2025-05-20  2:05 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: softworkz

From: softworkz <softworkz@hotmail.com>

---
 fftools/resources/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/resources/Makefile b/fftools/resources/Makefile
index 8579a52678..c655c9a431 100644
--- a/fftools/resources/Makefile
+++ b/fftools/resources/Makefile
@@ -5,7 +5,7 @@ vpath %.html $(SRC_PATH)
 vpath %.css  $(SRC_PATH)
 
 # Uncomment to prevent deletion during build
-#.PRECIOUS: %.css.c %.css.min %.css.gz %.css.min.gz %.html.gz %.html.c
+#.SECONDARY: %.css.c %.css.min %.css.gz %.css.min.gz %.html.gz %.html.c
 
 OBJS-resman +=                     \
     fftools/resources/resman.o     \
-- 
ffmpeg-codebot

_______________________________________________
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/ffmpeg: Free print_graph option variables
  2025-05-20  2:04 [FFmpeg-devel] [PATCH 0/5] Graphprint and Mermaid Fixes ffmpegagent
  2025-05-20  2:05 ` [FFmpeg-devel] [PATCH 1/5] fftools/makefile: Remove resources from ffprobe softworkz
  2025-05-20  2:05 ` [FFmpeg-devel] [PATCH 2/5] fftools/resources: Use .SECONDARY in Makefile comment softworkz
@ 2025-05-20  2:05 ` softworkz
  2025-05-20  2:05 ` [FFmpeg-devel] [PATCH 4/5] fftools/graphprint: Fix memory leaks softworkz
  2025-05-20  2:05 ` [FFmpeg-devel] [PATCH 5/5] fftools/tf_mermaid: Add missing uninit and fix leaks softworkz
  4 siblings, 0 replies; 6+ messages in thread
From: softworkz @ 2025-05-20  2:05 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: softworkz

From: softworkz <softworkz@hotmail.com>

---
 fftools/ffmpeg.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index bd6f22e421..de607cac93 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -344,6 +344,9 @@ static void ffmpeg_cleanup(int ret)
 
     av_freep(&filter_nbthreads);
 
+    av_freep(&print_graphs_file);
+    av_freep(&print_graphs_format);
+
     av_freep(&input_files);
     av_freep(&output_files);
 
-- 
ffmpeg-codebot

_______________________________________________
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/graphprint: Fix memory leaks
  2025-05-20  2:04 [FFmpeg-devel] [PATCH 0/5] Graphprint and Mermaid Fixes ffmpegagent
                   ` (2 preceding siblings ...)
  2025-05-20  2:05 ` [FFmpeg-devel] [PATCH 3/5] fftools/ffmpeg: Free print_graph option variables softworkz
@ 2025-05-20  2:05 ` softworkz
  2025-05-20  2:05 ` [FFmpeg-devel] [PATCH 5/5] fftools/tf_mermaid: Add missing uninit and fix leaks softworkz
  4 siblings, 0 replies; 6+ messages in thread
From: softworkz @ 2025-05-20  2:05 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: softworkz

From: softworkz <softworkz@hotmail.com>

- uninit resource manager
- free strings before overwriting
- unref hw_frames_context

Signed-off-by: softworkz <softworkz@hotmail.com>
---
 fftools/graph/graphprint.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fftools/graph/graphprint.c b/fftools/graph/graphprint.c
index 50f1a2ecdc..852a8f6c0c 100644
--- a/fftools/graph/graphprint.c
+++ b/fftools/graph/graphprint.c
@@ -318,6 +318,7 @@ static void print_link(GraphPrintContext *gpc, AVFilterLink *link)
 
     if (hw_frames_ctx && hw_frames_ctx->data)
         print_hwframescontext(gpc, (AVHWFramesContext *)hw_frames_ctx->data);
+    av_buffer_unref(&hw_frames_ctx);
 }
 
 static char sanitize_char(const char c)
@@ -1107,5 +1108,7 @@ cleanup:
 
 int print_filtergraphs(FilterGraph **graphs, int nb_graphs, InputFile **ifiles, int nb_ifiles, OutputFile **ofiles, int nb_ofiles)
 {
-    return print_filtergraphs_priv(graphs, nb_graphs, ifiles, nb_ifiles, ofiles, nb_ofiles);
+    int ret = print_filtergraphs_priv(graphs, nb_graphs, ifiles, nb_ifiles, ofiles, nb_ofiles);
+    ff_resman_uninit();
+    return ret;
 }
-- 
ffmpeg-codebot

_______________________________________________
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/tf_mermaid: Add missing uninit and fix leaks
  2025-05-20  2:04 [FFmpeg-devel] [PATCH 0/5] Graphprint and Mermaid Fixes ffmpegagent
                   ` (3 preceding siblings ...)
  2025-05-20  2:05 ` [FFmpeg-devel] [PATCH 4/5] fftools/graphprint: Fix memory leaks softworkz
@ 2025-05-20  2:05 ` softworkz
  4 siblings, 0 replies; 6+ messages in thread
From: softworkz @ 2025-05-20  2:05 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: softworkz

From: softworkz <softworkz@hotmail.com>

- merge forgotten uninit from work branch
- add set_str() function to free before overwriting
- fix some other leaks

Signed-off-by: softworkz <softworkz@hotmail.com>
---
 fftools/textformat/tf_mermaid.c | 45 +++++++++++++++++++++++++++------
 1 file changed, 37 insertions(+), 8 deletions(-)

diff --git a/fftools/textformat/tf_mermaid.c b/fftools/textformat/tf_mermaid.c
index 6147cf6eea..d3b9131ada 100644
--- a/fftools/textformat/tf_mermaid.c
+++ b/fftools/textformat/tf_mermaid.c
@@ -153,7 +153,6 @@ typedef struct MermaidContext {
     }  section_data[SECTION_MAX_NB_LEVELS];
 
     unsigned nb_link_captions[SECTION_MAX_NB_LEVELS]; ///< generic print buffer dedicated to each section,
-    AVBPrint section_pbuf[SECTION_MAX_NB_LEVELS]; ///< generic print buffer dedicated to each section,
     AVBPrint link_buf; ///< print buffer for writing diagram links
     AVDictionary *link_dict;
 } MermaidContext;
@@ -216,6 +215,32 @@ static av_cold int mermaid_init_html(AVTextFormatContext *tfc)
     return 0;
 }
 
+static av_cold int mermaid_uninit(AVTextFormatContext *tfc)
+{
+    MermaidContext *mmc = tfc->priv;
+
+    av_bprint_finalize(&mmc->link_buf, NULL);
+    av_dict_free(&mmc->link_dict);
+
+    for (unsigned i = 0; i < SECTION_MAX_NB_LEVELS; i++) {
+        av_freep(&mmc->section_data[i].dest_id);
+        av_freep(&mmc->section_data[i].section_id);
+        av_freep(&mmc->section_data[i].src_id);
+        av_freep(&mmc->section_data[i].section_type);
+    }
+
+    return 0;
+}
+
+static void set_str(const char **dst, const char *src)
+{
+    if (*dst)
+        av_freep(dst);
+
+    if (src)
+        *dst = av_strdup(src);
+}
+
 #define MM_INDENT() writer_printf(tfc, "%*c", mmc->indent_level * 2, ' ')
 
 static void mermaid_print_section_header(AVTextFormatContext *tfc, const void *data)
@@ -266,6 +291,8 @@ static void mermaid_print_section_header(AVTextFormatContext *tfc, const void *d
             break;
         }
 
+        av_bprint_finalize(&css_buf, NULL);
+        av_freep(&directive);
         return;
     }
 
@@ -310,7 +337,7 @@ static void mermaid_print_section_header(AVTextFormatContext *tfc, const void *d
         }
 
         mmc->section_data[tfc->level].subgraph_start_incomplete = 1;
-        mmc->section_data[tfc->level].section_id = av_strdup(sec_ctx->context_id);
+        set_str(&mmc->section_data[tfc->level].section_id, sec_ctx->context_id);
     }
 
     if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_SHAPE) {
@@ -322,7 +349,7 @@ static void mermaid_print_section_header(AVTextFormatContext *tfc, const void *d
 
         if (sec_ctx->context_id) {
 
-            mmc->section_data[tfc->level].section_id = av_strdup(sec_ctx->context_id);
+            set_str(&mmc->section_data[tfc->level].section_id, sec_ctx->context_id);
 
             switch (mmc->diagram_config->diagram_type) {
             case AV_DIAGRAMTYPE_GRAPH:
@@ -352,7 +379,7 @@ static void mermaid_print_section_header(AVTextFormatContext *tfc, const void *d
             av_log(tfc, AV_LOG_ERROR, "Unable to write shape start. Missing id field. Section: %s", section->name);
         }
 
-        mmc->section_data[tfc->level].section_id = av_strdup(sec_ctx->context_id);
+        set_str(&mmc->section_data[tfc->level].section_id, sec_ctx->context_id);
     }
 
 
@@ -371,7 +398,7 @@ static void mermaid_print_section_header(AVTextFormatContext *tfc, const void *d
         mmc->nb_link_captions[tfc->level] = 0;
 
         if (sec_ctx && sec_ctx->context_type)
-            mmc->section_data[tfc->level].section_type = av_strdup(sec_ctx->context_type);
+            set_str(&mmc->section_data[tfc->level].section_type, sec_ctx->context_type);
 
         ////if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE) {
         ////    AVBPrint buf;
@@ -533,17 +560,17 @@ static void mermaid_print_value(AVTextFormatContext *tfc, const char *key,
     int exit = 0;
 
     if (section->id_key && !strcmp(section->id_key, key)) {
-        mmc->section_data[tfc->level].section_id = av_strdup(str);
+        set_str(&mmc->section_data[tfc->level].section_id, str);
         exit = 1;
     }
 
     if (section->dest_id_key && !strcmp(section->dest_id_key, key)) {
-        mmc->section_data[tfc->level].dest_id = av_strdup(str);
+        set_str(&mmc->section_data[tfc->level].dest_id, str);
         exit = 1;
     }
 
     if (section->src_id_key && !strcmp(section->src_id_key, key)) {
-        mmc->section_data[tfc->level].src_id = av_strdup(str);
+        set_str(&mmc->section_data[tfc->level].src_id, str);
         exit = 1;
     }
 
@@ -636,6 +663,7 @@ const AVTextFormatter avtextformatter_mermaid = {
     .name                 = "mermaid",
     .priv_size            = sizeof(MermaidContext),
     .init                 = mermaid_init,
+    .uninit               = mermaid_uninit,
     .print_section_header = mermaid_print_section_header,
     .print_section_footer = mermaid_print_section_footer,
     .print_integer        = mermaid_print_int,
@@ -649,6 +677,7 @@ const AVTextFormatter avtextformatter_mermaidhtml = {
     .name                 = "mermaidhtml",
     .priv_size            = sizeof(MermaidContext),
     .init                 = mermaid_init_html,
+    .uninit               = mermaid_uninit,
     .print_section_header = mermaid_print_section_header,
     .print_section_footer = mermaid_print_section_footer,
     .print_integer        = mermaid_print_int,
-- 
ffmpeg-codebot
_______________________________________________
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:[~2025-05-20  2:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-20  2:04 [FFmpeg-devel] [PATCH 0/5] Graphprint and Mermaid Fixes ffmpegagent
2025-05-20  2:05 ` [FFmpeg-devel] [PATCH 1/5] fftools/makefile: Remove resources from ffprobe softworkz
2025-05-20  2:05 ` [FFmpeg-devel] [PATCH 2/5] fftools/resources: Use .SECONDARY in Makefile comment softworkz
2025-05-20  2:05 ` [FFmpeg-devel] [PATCH 3/5] fftools/ffmpeg: Free print_graph option variables softworkz
2025-05-20  2:05 ` [FFmpeg-devel] [PATCH 4/5] fftools/graphprint: Fix memory leaks softworkz
2025-05-20  2:05 ` [FFmpeg-devel] [PATCH 5/5] fftools/tf_mermaid: Add missing uninit and fix leaks softworkz

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