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 <[EMAIL PROTECTED]>
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/cmdopt.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: