[vlc-commits] subsdec: Fix memory leak

Hugo Beauzée-Luyssen git at videolan.org
Tue Dec 5 15:54:18 CET 2017


vlc/vlc-3.0 | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Dec  5 15:30:07 2017 +0100| [103010adc380c9f1962147e850cf21d7b419d2cf] | committer: Hugo Beauzée-Luyssen

subsdec: Fix memory leak

(cherry picked from commit 589f928104478fee5901db0d0b2e1e829fbe30dd)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 modules/codec/subsdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/codec/subsdec.c b/modules/codec/subsdec.c
index abc6786f29..23df009110 100644
--- a/modules/codec/subsdec.c
+++ b/modules/codec/subsdec.c
@@ -678,7 +678,7 @@ static text_style_t* DuplicateAndPushStyle(style_stack_t** pp_stack)
     style_stack_t* p_entry = malloc( sizeof( *p_entry ) );
     if ( unlikely( !p_entry ) )
     {
-        free( p_dup );
+        text_style_Delete( p_dup );
         return NULL;
     }
     // Give the style ownership to the segment.
@@ -792,12 +792,14 @@ static text_segment_t* ParseSubtitles( int *pi_align, const char *psz_subtitle )
                         }
                         if ( !strcasecmp( psz_attribute_name, "face" ) )
                         {
+                            free(p_segment->style->psz_fontname);
                             p_segment->style->psz_fontname = psz_attribute_value;
                             // We don't want to free the attribute value since it has become our fontname
                             psz_attribute_value = NULL;
                         }
                         else if ( !strcasecmp( psz_attribute_name, "family" ) )
                         {
+                            free(p_segment->style->psz_monofontname);
                             p_segment->style->psz_monofontname = psz_attribute_value;
                             psz_attribute_value = NULL;
                         }



More information about the vlc-commits mailing list