Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 72104 invoked from network); 24 Apr 2008 06:04:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Apr 2008 06:04:15 -0000 Received: (qmail 52461 invoked by uid 500); 24 Apr 2008 06:04:17 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 52443 invoked by uid 500); 24 Apr 2008 06:04:17 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 52427 invoked by uid 99); 24 Apr 2008 06:04:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Apr 2008 23:04:17 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of msebor@gmail.com designates 209.85.198.224 as permitted sender) Received: from [209.85.198.224] (HELO rv-out-0506.google.com) (209.85.198.224) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2008 06:03:32 +0000 Received: by rv-out-0506.google.com with SMTP id g37so1577214rvb.23 for ; Wed, 23 Apr 2008 23:03:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:organization:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; bh=q/afNwZzgdG/7cWkjOYDAqg4DcvibldSGDSoYtR3ZGY=; b=Kf63A0pmBXZurxhejVL8nWA0V4nYXz3BtdL7FY7AvgP1J2Ao012DTDQNf5Ev8346vY1s754/dPH+WdiQUscx2+gCL8j0hcgx4v5VNDp3y2LGrAnZUWMAhY4Yfa8MR4prQxQSEFaVAKDKABb5nz8LMRgjNQKCn9H3zwdkwto7UGU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:organization:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=AiNQLsbm4DUclhVCzS55equggKpYfYHYg+xk4PyuUw4i2C/VLUIQ0hPVdc9fa1PuIV9ewMVcQ6hraM7Ygw5i+yJOFH3qZ0NBxGdu4LyopgaUEnLtWnfVbvvT5Uur1s+NHKfARslG85csqUT+XLr3/SM2BUKtYKwbP0/NXW/lkPU= Received: by 10.140.174.18 with SMTP id w18mr1053792rve.227.1209017025433; Wed, 23 Apr 2008 23:03:45 -0700 (PDT) Received: from localhost.localdomain ( [71.229.200.170]) by mx.google.com with ESMTPS id c20sm1361974rvf.3.2008.04.23.23.03.44 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 23 Apr 2008 23:03:45 -0700 (PDT) Message-ID: <481022C0.3080001@roguewave.com> Date: Thu, 24 Apr 2008 00:03:44 -0600 From: Martin Sebor Organization: Rogue Wave Software, Inc. User-Agent: Thunderbird 2.0.0.12 (X11/20080226) MIME-Version: 1.0 To: dev@stdcxx.apache.org Subject: Re: svn commit: r650698 - /stdcxx/branches/4.2.x/tests/src/cmdopt.cpp References: <20080422233842.204FF1A9832@eris.apache.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: Martin Sebor X-Virus-Checked: Checked by ClamAV on apache.org Eric Lemings wrote: > > Rather than having malloc() function calls scattered throughout the test > driver, I was wondering if a conventional malloc() wrapper wouldn't take > care of a lot of this error checking and null pointer dereference > warnings. A conventional Unix malloc() wrapper checks the return value > and just prints a diagnostic and exits the program if it is null. I think it would make sense. We already do something like this in other areas of the driver (and/or the exec utility) to simplify error handling. Martin > > Brad. > >> -----Original Message----- >> From: sebor@apache.org [mailto:sebor@apache.org] >> Sent: Tuesday, April 22, 2008 5:39 PM >> To: commits@stdcxx.apache.org >> Subject: svn commit: r650698 - >> /stdcxx/branches/4.2.x/tests/src/cmdopt.cpp >> >> Author: sebor >> Date: Tue Apr 22 16:38:40 2008 >> New Revision: 650698 >> >> URL: http://svn.apache.org/viewvc?rev=650698&view=rev >> Log: >> 2008-04-22 Martin Sebor >> >> STDCXX-754 >> * tests/src/cmdopt.cpp (rw_vsetopts): Handled malloc() failure. >> Added an assertion to silence a bogus HP aCC 6/cadvise warning >> #20200-D: Potential null pointer dereference. Unfortunately, >> with the one gone another bogus one pops up... >> >> Modified: >> stdcxx/branches/4.2.x/tests/src/cmdopt.cpp >> >> Modified: stdcxx/branches/4.2.x/tests/src/cmdopt.cpp >> URL: >> http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/src/c >> mdopt.cpp?rev=650698&r1=650697&r2=650698&view=diff >> ============================================================== >> ================ >> --- stdcxx/branches/4.2.x/tests/src/cmdopt.cpp (original) >> +++ stdcxx/branches/4.2.x/tests/src/cmdopt.cpp Tue Apr 22 >> 16:38:40 2008 >> @@ -20,7 +20,7 @@ >> * implied. See the License for the specific language >> governing >> * permissions and limitations under the License. >> * >> - * Copyright 2005-2006 Rogue Wave Software. >> + * Copyright 2005-2008 Rogue Wave Software, Inc. >> * >> >> ************************************************************** >> ************/ >> >> @@ -518,6 +518,8 @@ >> lopt = lastopt->loptbuf_; >> else { >> lopt = (char*)malloc (optlen + 1); >> + if (0 == lopt) >> + return -1; // error >> lastopt->lopt_ = lopt; >> } >> >> @@ -533,6 +535,8 @@ >> lastopt->maxcount_ = 1; >> >> int arg_is_callback = true; >> + >> + RW_ASSERT (0 != next); >> >> if ('#' == *next) { >> // examples of option specification: >> >> >>