Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 59D349BF9 for ; Wed, 25 Apr 2012 17:33:19 +0000 (UTC) Received: (qmail 71181 invoked by uid 500); 25 Apr 2012 17:33:19 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 71099 invoked by uid 500); 25 Apr 2012 17:33:19 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 71092 invoked by uid 99); 25 Apr 2012 17:33:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Apr 2012 17:33:19 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Apr 2012 17:33:18 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 3143423889BB; Wed, 25 Apr 2012 17:32:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1330431 - /subversion/trunk/subversion/libsvn_repos/hooks.c Date: Wed, 25 Apr 2012 17:32:58 -0000 To: commits@subversion.apache.org From: stsp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120425173258.3143423889BB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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)