subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1330431 - /subversion/trunk/subversion/libsvn_repos/hooks.c
Date Wed, 25 Apr 2012 17:32:58 GMT
Author: stsp
Date: Wed Apr 25 17:32:57 2012
New Revision: 1330431

URL: http://svn.apache.org/viewvc?rev=1330431&view=rev
Log:
Follow up to r1330410 and r1330424, fix potential file handle leaks.

* subversion/libsvn_repos/hooks.c
  (run_hook_cmd): Don't use the SVN_ERR() macro -- avoid an early return
   that might leak file handles we're trying to close. And always try to
   close the null_handle regardless of the status of 'err'.

Modified:
    subversion/trunk/subversion/libsvn_repos/hooks.c

Modified: subversion/trunk/subversion/libsvn_repos/hooks.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/hooks.c?rev=1330431&r1=1330430&r2=1330431&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/hooks.c (original)
+++ subversion/trunk/subversion/libsvn_repos/hooks.c Wed Apr 25 17:32:57 2012
@@ -255,7 +255,7 @@ run_hook_cmd(svn_string_t **result,
   if (!err && result)
     {
       svn_stringbuf_t *native_stdout;
-      SVN_ERR(svn_stringbuf_from_aprfile(&native_stdout, cmd_proc.out, pool));
+      err = svn_stringbuf_from_aprfile(&native_stdout, cmd_proc.out, pool);
       apr_err = apr_file_close(cmd_proc.out);
       if (!err && apr_err)
         return svn_error_wrap_apr
@@ -263,7 +263,7 @@ run_hook_cmd(svn_string_t **result,
 
       *result = svn_stringbuf__morph_into_string(native_stdout);
     }
-  else if (null_handle)
+  if (null_handle)
     {
       apr_err = apr_file_close(null_handle);
       if (!err && apr_err)



Mime
View raw message