mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 07:11:49 +00:00
Make sure the Archive gets deleted if there's an error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18869 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
061e9491f8
commit
518ec2ea1f
@ -282,9 +282,9 @@ Archive::loadArchive() {
|
||||
Archive*
|
||||
Archive::OpenAndLoad(const sys::Path& file, std::string* ErrorMessage) {
|
||||
try {
|
||||
Archive* result = new Archive(file, true);
|
||||
std::auto_ptr<Archive> result ( new Archive(file, true));
|
||||
result->loadArchive();
|
||||
return result;
|
||||
return result.release();
|
||||
} catch (const std::string& msg) {
|
||||
if (ErrorMessage) {
|
||||
*ErrorMessage = msg;
|
||||
@ -377,9 +377,9 @@ Archive::loadSymbolTable() {
|
||||
Archive*
|
||||
Archive::OpenAndLoadSymbols(const sys::Path& file, std::string* ErrorMessage) {
|
||||
try {
|
||||
Archive* result = new Archive(file, true);
|
||||
std::auto_ptr<Archive> result ( new Archive(file, true) );
|
||||
result->loadSymbolTable();
|
||||
return result;
|
||||
return result.release();
|
||||
} catch (const std::string& msg) {
|
||||
if (ErrorMessage) {
|
||||
*ErrorMessage = msg;
|
||||
|
@ -282,9 +282,9 @@ Archive::loadArchive() {
|
||||
Archive*
|
||||
Archive::OpenAndLoad(const sys::Path& file, std::string* ErrorMessage) {
|
||||
try {
|
||||
Archive* result = new Archive(file, true);
|
||||
std::auto_ptr<Archive> result ( new Archive(file, true));
|
||||
result->loadArchive();
|
||||
return result;
|
||||
return result.release();
|
||||
} catch (const std::string& msg) {
|
||||
if (ErrorMessage) {
|
||||
*ErrorMessage = msg;
|
||||
@ -377,9 +377,9 @@ Archive::loadSymbolTable() {
|
||||
Archive*
|
||||
Archive::OpenAndLoadSymbols(const sys::Path& file, std::string* ErrorMessage) {
|
||||
try {
|
||||
Archive* result = new Archive(file, true);
|
||||
std::auto_ptr<Archive> result ( new Archive(file, true) );
|
||||
result->loadSymbolTable();
|
||||
return result;
|
||||
return result.release();
|
||||
} catch (const std::string& msg) {
|
||||
if (ErrorMessage) {
|
||||
*ErrorMessage = msg;
|
||||
|
Loading…
Reference in New Issue
Block a user