Module Name: src
Committed By: maya
Date: Sat Nov 11 14:16:06 UTC 2017
Modified Files:
src/external/bsd/atf/dist/tools: fs.cpp
Log Message:
don't use auto_ptr with memory allocated by C code
silences alloc-dealloc-mismatch warnings from asan
from joerg
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/atf/dist/tools/fs.cpp
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/bsd/atf/dist/tools/fs.cpp
diff -u src/external/bsd/atf/dist/tools/fs.cpp:1.3 src/external/bsd/atf/dist/tools/fs.cpp:1.4
--- src/external/bsd/atf/dist/tools/fs.cpp:1.3 Tue Feb 11 18:13:45 2014
+++ src/external/bsd/atf/dist/tools/fs.cpp Sat Nov 11 14:16:06 2017
@@ -707,11 +707,17 @@ impl::cleanup(const path& p)
impl::path
impl::get_current_dir(void)
{
- std::auto_ptr< char > cwd;
- cwd.reset(getcwd(NULL, 0));
- if (cwd.get() == NULL)
+ char *cwd = getcwd(NULL, 0);
+ if (cwd == NULL)
throw tools::system_error(IMPL_NAME "::get_current_dir()",
"getcwd() failed", errno);
- return path(cwd.get());
+ try {
+ impl::path p(cwd);
+ free(cwd);
+ return p;
+ } catch(...) {
+ free(cwd);
+ throw;
+ }
}