Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 71269 invoked from network); 22 Aug 2006 16:13:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Aug 2006 16:13:41 -0000 Received: (qmail 94164 invoked by uid 500); 22 Aug 2006 16:13:41 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 94108 invoked by uid 500); 22 Aug 2006 16:13:41 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 94095 invoked by uid 99); 22 Aug 2006 16:13:41 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Aug 2006 09:13:41 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [208.30.140.160] (HELO moroha.quovadx.com) (208.30.140.160) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Aug 2006 09:13:40 -0700 Received: from qxvcexch01.ad.quovadx.com (qxvcexch01.ad.quovadx.com [192.168.170.59]) by moroha.quovadx.com (8.13.6/8.13.4) with ESMTP id k7MGD9kk023354 for ; Tue, 22 Aug 2006 16:13:17 GMT Received: from [10.70.3.113] ([10.70.3.113]) by qxvcexch01.ad.quovadx.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 22 Aug 2006 10:13:31 -0600 Message-ID: <44EB2D29.7020802@roguewave.com> Date: Tue, 22 Aug 2006 10:13:29 -0600 From: Martin Sebor Organization: Rogue Wave Software User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050920 X-Accept-Language: en-us, en MIME-Version: 1.0 To: stdcxx-dev@incubator.apache.org Subject: Re: [patch] Exec utility memory leak fix References: <44E64778.8010507@roguewave.com> <44EA5B8D.40800@roguewave.com> <44EB16E9.2070702@roguewave.com> In-Reply-To: <44EB16E9.2070702@roguewave.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 22 Aug 2006 16:13:31.0720 (UTC) FILETIME=[E9422480:01C6C605] X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Andrew Black wrote: > Looking at the .rej file, I'm not seeing the difference between the two > sections indicated. > > What does it look like if you execute 'svn diff runall.cpp | diff > runall.patch -' after applying the patch? If there is no difference > between the resulting patches, it would seem to me that the solaris > patch utility has issues. Sorry, I have no time to play with it today. There are known incompatibilities between GNU patch (I assume that's what you used) and other implementations of the utility so maybe it's one of them. Martin > > --Andrew Black > > Martin Sebor wrote: > >> Andrew Black wrote: >> >>> Greetings all. >>> >>> Below is a short patch to fix a couple minor memory leaks in the exec >>> utility. This leak was likely introduced with the support for >>> complex targets. >> >> >> Hmm, I'm having trouble applying this patch on Solaris 9. >> Attached is the the patch itself (copied from your post) >> and the .rej file. Do you see what the problem is? >> >> Martin >> >>> >>> --Andrew Black >>> >>> Log: >>> * runall.cpp (merge_argv): Update function documentation. >>> (run_target): Free argv array returned by merge_argv. >>> >>> Index: runall.cpp >>> =================================================================== >>> --- runall.cpp (revision 432706) >>> +++ runall.cpp (working copy) >>> @@ -73,6 +73,9 @@ >>> argument string is '%x' (no quotes), the contents of the provided >>> argv >>> array will be inserted into the return array at that point. >>> >>> + It is the responsibility of the caller to free() the returned >>> blocks of >>> + memory, which were allocated by a call to split_opt_string(). >>> + >>> @todo Figure out an escaping mechanism to allow '%x' to be passed >>> to an >>> executable >>> >>> @@ -402,7 +405,6 @@ >>> static void >>> run_target (char* target, char** argv) >>> { >>> - struct exec_attrs status; >>> char** childargv; >>> >>> assert (0 != target); >>> @@ -418,12 +420,13 @@ >>> printf ("%-25.25s ", target_name); >>> fflush (stdout); >>> >>> - if (!check_target_ok (childargv [0])) >>> - return; >>> + if (check_target_ok (childargv [0])) { >>> + struct exec_attrs status = exec_file (childargv); >>> + process_results (childargv [0], &status); >>> + } >>> >>> - status = exec_file (childargv); >>> - >>> - process_results (childargv [0], &status); >>> + free (childargv [0]); >>> + free (childargv); >>> } >>> >>> /** >>> >>