[vlc-devel] commit: Close file in all cases. ( Rémi Duraffort )

git version control git at videolan.org
Mon Jun 23 21:27:07 CEST 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Mon Jun 23 21:25:57 2008 +0200| [3cdff66bb4ac97489defa9c58b90704c44efa0ff]

Close file in all cases.

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

 modules/misc/svg.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/modules/misc/svg.c b/modules/misc/svg.c
index 02ad4e1..e059ea3 100644
--- a/modules/misc/svg.c
+++ b/modules/misc/svg.c
@@ -200,11 +200,14 @@ static char *svg_GetTemplate( vlc_object_t *p_this )
 
                 psz_template = malloc( ( s.st_size + 42 ) * sizeof( char ) );
                 if( !psz_template )
+                {
+                    fclose( file );
                     return NULL;
+                }
                 memset( psz_template, 0, s.st_size + 1 );
                 fread( psz_template, s.st_size, 1, file );
-                fclose( file );
             }
+            fclose( file );
         }
     }
     if( !psz_template )




More information about the vlc-devel mailing list