[vlc-devel] commit: Fix CID: 101 resource leak in osdmenu parser. (Jean-Paul Saman )

git version control git at videolan.org
Sat May 31 14:55:17 CEST 2008


vlc | branch: master | Jean-Paul Saman <jpsaman at videolan.org> | Sat May 31 14:43:14 2008 +0200| [b5aea37246dccbbc96ada824df72ac54ae38ed5e]

Fix CID: 101 resource leak in osdmenu parser.

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

 modules/misc/osd/simple.c |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/modules/misc/osd/simple.c b/modules/misc/osd/simple.c
index 30c9bdf..059d4f0 100644
--- a/modules/misc/osd/simple.c
+++ b/modules/misc/osd/simple.c
@@ -270,9 +270,15 @@ int osd_parser_simpleOpen( vlc_object_t *p_this )
                         else /* absolute paths are used. */
                             p_range_current = osd_StateNew( p_menu, &file[0], "pressed" );
 
-                        if( !p_range_current || !p_range_current->p_pic )
+                        if( !p_range_current )
                             goto error;
 
+                        if( !p_range_current->p_pic )
+                        {
+                            osd_StatesFree( p_menu, p_range_current );
+                            goto error;
+                        }
+
                         p_range_current->i_x = i_x;
                         p_range_current->i_y = i_y;
 
@@ -369,8 +375,14 @@ int osd_parser_simpleOpen( vlc_object_t *p_this )
                     else /* absolute paths are used. */
                         p_range_current = osd_StateNew( p_menu, &file[0], "pressed" );
 
-                    if( !p_range_current || !p_range_current->p_pic )
+                    if( !p_range_current )
+                        goto error;
+
+                    if( !p_range_current->p_pic )
+                    {
+                        osd_StatesFree( p_menu, p_range_current );
                         goto error;
+                    }
 
                     p_range_current->i_x = i_x;
                     p_range_current->i_y = i_y;
@@ -439,8 +451,14 @@ int osd_parser_simpleOpen( vlc_object_t *p_this )
             else /* absolute paths are used. */
                 p_state_current = osd_StateNew( p_menu, &file[0], &state[0] );
 
-            if( !p_state_current || !p_state_current->p_pic )
+            if( !p_state_current )
+                goto error;
+
+            if( !p_state_current->p_pic )
+            {
+                osd_StatesFree( p_menu, p_state_current );
                 goto error;
+            }
 
             p_state_current->i_x = i_x;
             p_state_current->i_y = i_y;




More information about the vlc-devel mailing list