mirror of
https://github.com/simon987/sist2.git
synced 2025-04-19 02:06:46 +00:00
Fix memory leaks (whoops)
This commit is contained in:
parent
d1a2f9b1d5
commit
b7f13f425c
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -322,6 +322,8 @@ void parse_media_filename(const char *filepath, document_t *doc) {
|
|||||||
int res = avformat_open_input(&pFormatCtx, filepath, NULL, NULL);
|
int res = avformat_open_input(&pFormatCtx, filepath, NULL, NULL);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
LOG_ERRORF(doc->filepath, "(media.c) avformat_open_input() returned [%d] %s", res, av_err2str(res))
|
LOG_ERRORF(doc->filepath, "(media.c) avformat_open_input() returned [%d] %s", res, av_err2str(res))
|
||||||
|
avformat_close_input(&pFormatCtx);
|
||||||
|
avformat_free_context(pFormatCtx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,13 +359,22 @@ void parse_media_vfile(struct vfile *f, document_t *doc) {
|
|||||||
int res = avformat_open_input(&pFormatCtx, "", NULL, NULL);
|
int res = avformat_open_input(&pFormatCtx, "", NULL, NULL);
|
||||||
if (res == -5) {
|
if (res == -5) {
|
||||||
// Tried to parse media that requires seek
|
// Tried to parse media that requires seek
|
||||||
|
av_free(io_ctx->buffer);
|
||||||
|
avio_context_free(&io_ctx);
|
||||||
|
avformat_close_input(&pFormatCtx);
|
||||||
|
avformat_free_context(pFormatCtx);
|
||||||
return;
|
return;
|
||||||
} else if (res < 0) {
|
} else if (res < 0) {
|
||||||
LOG_ERRORF(doc->filepath, "(media.c) avformat_open_input() returned [%d] %s", res, av_err2str(res))
|
LOG_ERRORF(doc->filepath, "(media.c) avformat_open_input() returned [%d] %s", res, av_err2str(res))
|
||||||
|
av_free(io_ctx->buffer);
|
||||||
|
avio_context_free(&io_ctx);
|
||||||
|
avformat_close_input(&pFormatCtx);
|
||||||
|
avformat_free_context(pFormatCtx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_media(pFormatCtx, doc);
|
parse_media(pFormatCtx, doc);
|
||||||
av_free(io_ctx);
|
av_free(io_ctx->buffer);
|
||||||
|
avio_context_free(&io_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1193,6 +1193,8 @@ g_hash_table_insert(ext_table, "srt", (gpointer)text_plain);
|
|||||||
g_hash_table_insert(ext_table, "nfo", (gpointer)text_plain);
|
g_hash_table_insert(ext_table, "nfo", (gpointer)text_plain);
|
||||||
g_hash_table_insert(ext_table, "sfv", (gpointer)text_plain);
|
g_hash_table_insert(ext_table, "sfv", (gpointer)text_plain);
|
||||||
g_hash_table_insert(ext_table, "m3u", (gpointer)text_plain);
|
g_hash_table_insert(ext_table, "m3u", (gpointer)text_plain);
|
||||||
|
g_hash_table_insert(ext_table, "csv", (gpointer)text_plain);
|
||||||
|
g_hash_table_insert(ext_table, "eml", (gpointer)text_plain);
|
||||||
g_hash_table_insert(ext_table, "rt", (gpointer)text_richtext);
|
g_hash_table_insert(ext_table, "rt", (gpointer)text_richtext);
|
||||||
g_hash_table_insert(ext_table, "rtf", (gpointer)text_richtext);
|
g_hash_table_insert(ext_table, "rtf", (gpointer)text_richtext);
|
||||||
g_hash_table_insert(ext_table, "rtx", (gpointer)text_richtext);
|
g_hash_table_insert(ext_table, "rtx", (gpointer)text_richtext);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user