diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2006-10-23 23:31:00 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2006-10-23 23:31:00 +0000 |
commit | 493991791e3c7232fa33f428177dbfc9b666adac (patch) | |
tree | f937218c26da44d35b11b3ddeee1804031b5d99a /ACE/ace/Configuration_Import_Export.cpp | |
parent | fe745d19b69bcac8e99ca5304656eada195cd1c6 (diff) | |
download | ATCD-493991791e3c7232fa33f428177dbfc9b666adac.tar.gz |
ChangeLogTag:Mon Oct 23 02:28:42 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
Diffstat (limited to 'ACE/ace/Configuration_Import_Export.cpp')
-rw-r--r-- | ACE/ace/Configuration_Import_Export.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/ACE/ace/Configuration_Import_Export.cpp b/ACE/ace/Configuration_Import_Export.cpp index d3599af834f..7c5ee7fb03c 100644 --- a/ACE/ace/Configuration_Import_Export.cpp +++ b/ACE/ace/Configuration_Import_Export.cpp @@ -1,6 +1,7 @@ // $Id$ #include "ace/Configuration_Import_Export.h" +#include "ace/OS_Errno.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_ctype.h" #include "ace/OS_NS_string.h" @@ -42,7 +43,13 @@ ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename) u_int buffer_size = 4096; u_int read_pos = 0; ACE_TCHAR *buffer; - ACE_NEW_RETURN (buffer, ACE_TCHAR[buffer_size], -1); + ACE_NEW_NORETURN (buffer, ACE_TCHAR[buffer_size]); + if (!buffer) + { + ACE_Errno_Guard guard (errno); + (void) ACE_OS::fclose (in); + return -1; + } ACE_Configuration_Section_Key section; ACE_TCHAR *end = 0; @@ -55,7 +62,14 @@ ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename) { // allocate a new buffer - double size the previous one ACE_TCHAR *temp_buffer; - ACE_NEW_RETURN (temp_buffer, ACE_TCHAR[buffer_size * 2], -1); + ACE_NEW_NORETURN (temp_buffer, ACE_TCHAR[buffer_size * 2]); + if (!temp_buffer) + { + ACE_Errno_Guard guard (errno); + delete [] buffer; + (void) ACE_OS::fclose (in); + return -1; + } // copy the beginnning of the line ACE_OS::memcpy (temp_buffer, buffer, buffer_size); |