[FFmpeg-devel] [PATCH v1] avformat/dashdec: remove xmlCleanupParser call in dashdec
Steven Liu
lq at chinaffmpeg.org
Thu Oct 10 18:14:09 EEST 2024
Because there have global varible in libxml2, it cleans up memory allocated by
the library itself. It is a cleanup function for the XML library.
It tries to reclaim all related global memory allocated for the library processing.
It doesn't deallocate any document related memory.
One should call xmlCleanupParser() only when the process has finished using the library
and all XML/HTML documents built with it.
See also xmlInitParser() which has the opposite function of preparing the library
for operations. if there are multithreaded or has plugin support calling
this may crash the application if another thread or a plugin is still using libxml2.
So give a warning message to user for call xmlCleanupParser by themselves.
Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
---
libavformat/dashdec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 99ac6197be..c33ddb9ea4 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1362,7 +1362,6 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in)
cleanup:
/*free the document */
xmlFreeDoc(doc);
- xmlCleanupParser();
xmlFreeNode(mpd_baseurl_node);
}
@@ -2026,6 +2025,7 @@ static int dash_read_header(AVFormatContext *s)
if ((ret = ffio_copy_url_options(s->pb, &c->avio_opts)) < 0)
return ret;
+ av_log(s, AV_LOG_WARNING, "Have not call xmlCleanupParser yet, you should call it by yourself\n");
if ((ret = parse_manifest(s, s->url, s->pb)) < 0)
return ret;
--
2.39.3 (Apple Git-146)
More information about the ffmpeg-devel
mailing list