]> git.sesse.net Git - x264/commitdiff
mp4: Fix file handle leak
authorAnton Mitrofanov <BugMaster@narod.ru>
Fri, 24 Jul 2015 21:20:47 +0000 (00:20 +0300)
committerAnton Mitrofanov <BugMaster@narod.ru>
Fri, 24 Jul 2015 21:43:38 +0000 (00:43 +0300)
output/mp4.c

index 2cf81f5a9ae45b5921e1a52e3ac2500ca7af9460..c0af118907f63dfab34d8d3ac64cb34769c6e1a9 100644 (file)
@@ -169,8 +169,9 @@ static int open_file( char *psz_filename, hnd_t *p_handle, cli_output_opt_t *opt
     FILE *fh = x264_fopen( psz_filename, "w" );
     if( !fh )
         return -1;
-    FAIL_IF_ERR( !x264_is_regular_file( fh ), "mp4", "MP4 output is incompatible with non-regular file `%s'\n", psz_filename )
+    int b_regular = x264_is_regular_file( fh );
     fclose( fh );
+    FAIL_IF_ERR( !b_regular, "mp4", "MP4 output is incompatible with non-regular file `%s'\n", psz_filename )
 
     mp4_hnd_t *p_mp4 = calloc( 1, sizeof(mp4_hnd_t) );
     if( !p_mp4 )