[vlc-devel] commit: Fix CID: 101 Resource leak in osd_ConfigLoader ( backport from b5aea37246dccbbc96ada824df72ac54ae38ed5e) (Jean-Paul Saman )

git version control git at videolan.org
Sat May 31 15:04:50 CEST 2008


vlc | branch: 0.8.6-bugfix | Jean-Paul Saman <jpsaman at videolan.org> | Sat May 31 15:02:49 2008 +0200| [838c50f0b5d2cec23fdc1a54c91797a506474e71]

Fix CID: 101 Resource leak in osd_ConfigLoader (backport from b5aea37246dccbbc96ada824df72ac54ae38ed5e)

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

 src/osd/osd_parser.c |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/src/osd/osd_parser.c b/src/osd/osd_parser.c
index b9dce88..c762588 100644
--- a/src/osd/osd_parser.c
+++ b/src/osd/osd_parser.c
@@ -2,7 +2,7 @@
  * osd_parser.c - The OSD Menu  parser core code.
  *****************************************************************************
  * Copyright (C) 2005 M2X
- * $Id$
+ * $Id: b9dce88c715e66ff5dff749e8a5a559cf4f11092 $
  *
  * Authors: Jean-Paul Saman <jpsaman #_at_# m2x dot nl>
  *
@@ -506,9 +506,15 @@ int osd_ConfigLoader( vlc_object_t *p_this, const char *psz_file,
                         else /* absolute paths are used. */
                             p_range_current = osd_StateNew( p_this, &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;
+                        }
+
                         /* increment the number of ranges for this button */
                         p_up->i_ranges++;
 
@@ -601,8 +607,14 @@ int osd_ConfigLoader( vlc_object_t *p_this, const char *psz_file,
                     else /* absolute paths are used. */
                         p_range_current = osd_StateNew( p_this, &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;
+                    }
 
                     /* increment the number of ranges for this button */
                     p_current->i_ranges++;
@@ -667,8 +679,14 @@ int osd_ConfigLoader( vlc_object_t *p_this, const char *psz_file,
             else /* absolute paths are used. */
                 p_state_current = osd_StateNew( p_this, &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;
+            }
 
             if( p_state_prev )
                 p_state_prev->p_next = p_state_current;




More information about the vlc-devel mailing list