[vlc-devel] [PATCH 08/12] input: subtitles: Remove use of VLA
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Tue Dec 8 15:19:12 CET 2020
---
src/input/subtitles.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/input/subtitles.c b/src/input/subtitles.c
index 25ebb52087..6598aaa0fc 100644
--- a/src/input/subtitles.c
+++ b/src/input/subtitles.c
@@ -283,9 +283,22 @@ int subtitles_Detect( input_thread_t *p_this, char *psz_path, const char *psz_na
if( psz_name[0] == '.' || !subtitles_Filter( psz_name ) )
continue;
- char tmp_fname_noext[strlen( psz_name ) + 1];
- char tmp_fname_trim[strlen( psz_name ) + 1];
- char tmp_fname_ext[strlen( psz_name ) + 1];
+ char *tmp_fname_noext = malloc(strlen( psz_name ) + 1);
+ if (!tmp_fname_noext)
+ continue;
+ char *tmp_fname_trim = malloc(strlen( psz_name ) + 1);
+ if (!tmp_fname_trim)
+ {
+ free(tmp_fname_noext);
+ continue;
+ }
+ char *tmp_fname_ext = malloc(strlen( psz_name ) + 1);
+ if (!tmp_fname_ext)
+ {
+ free(tmp_fname_noext);
+ free(tmp_fname_trim);
+ continue;
+ }
const char *tmp;
int i_prio = 0;
@@ -320,6 +333,9 @@ int subtitles_Detect( input_thread_t *p_this, char *psz_path, const char *psz_na
/* doesn't contain the movie name, prefer files in f_dir over subdirs */
i_prio = SLAVE_PRIORITY_MATCH_NONE;
}
+ free(tmp_fname_ext);
+ free(tmp_fname_trim);
+ free(tmp_fname_noext);
if( i_prio >= i_fuzzy )
{
struct stat st;
--
2.29.2
More information about the vlc-devel
mailing list