Fix an instance where an allocation wasn't checked for success.

Wrap call to SymbolLookup::Init() in a try/catch block since it could
potentially throw an exception. This was causing the debugger to terminate
in some instances.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40046 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent 2010-12-31 17:17:19 +00:00
parent 357eb4e314
commit 6997467eea

View File

@ -353,24 +353,30 @@ debug_create_symbol_lookup_context(team_id team,
// create the lookup context
debug_symbol_lookup_context *lookupContext
= new(nothrow) debug_symbol_lookup_context;
= new(std::nothrow) debug_symbol_lookup_context;
if (lookupContext == NULL)
return B_NO_MEMORY;
ObjectDeleter<debug_symbol_lookup_context> contextDeleter(lookupContext);
// create and init symbol lookup
SymbolLookup *lookup = new(nothrow) SymbolLookup(team);
if (!lookup)
SymbolLookup *lookup = new(std::nothrow) SymbolLookup(team);
if (lookup == NULL)
return B_NO_MEMORY;
ObjectDeleter<SymbolLookup> lookupDeleter(lookup);
status_t error = lookup->Init();
if (error != B_OK) {
delete lookup;
return error;
try {
status_t error = lookup->Init();
if (error != B_OK)
return error;
} catch (BPrivate::Debug::Exception exception) {
return exception.Error();
}
// everything went fine: return the result
lookupContext->lookup = lookup;
*_lookupContext = lookupContext;
contextDeleter.Detach();
lookupDeleter.Detach();
return B_OK;
}