[vlc-devel] [PATCH] subtitle: fix a potential memory leak

Simon Latapie garf at videolan.org
Tue Nov 7 19:39:04 CET 2017


Fixes the Coverity defect 403210.

Breaking the switch case will end up freeing psz_orig and continue the loop.
---
 modules/demux/subtitle.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index 7ef29744f1..cfbe106d1f 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -1884,7 +1884,7 @@ static int ParseJSS( vlc_object_t *p_obj, subs_properties_t *p_props,
             case 'S':
                  shift = isalpha( (unsigned char)psz_text[2] ) ? 6 : 2 ;
                  if ( shift > line_length )
-                     continue;
+                     break;
 
                  if( sscanf( &psz_text[shift], "%d", &h ) )
                  {
@@ -1923,7 +1923,7 @@ static int ParseJSS( vlc_object_t *p_obj, subs_properties_t *p_props,
             case 'T':
                 shift = isalpha( (unsigned char)psz_text[2] ) ? 8 : 2 ;
                 if ( shift > line_length )
-                    continue;
+                    break;
 
                 sscanf( &psz_text[shift], "%d", &p_props->jss.i_time_resolution );
                 break;
-- 
2.11.0



More information about the vlc-devel mailing list