[vlc-commits] subtitle: fix a potential memory leak

Simon Latapie git at videolan.org
Fri Nov 10 10:43:45 CET 2017


vlc | branch: master | Simon Latapie <garf at videolan.org> | Tue Nov  7 19:39:04 2017 +0100| [e96860acd9993f7409d335018987af73ecc3d947] | committer: Thomas Guillem

subtitle: fix a potential memory leak

Fixes the Coverity defect 403210.

Breaking the switch case will end up freeing psz_orig and continue the loop.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e96860acd9993f7409d335018987af73ecc3d947
---

 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;



More information about the vlc-commits mailing list