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:
parent
357eb4e314
commit
6997467eea
@ -353,24 +353,30 @@ debug_create_symbol_lookup_context(team_id team,
|
|||||||
|
|
||||||
// create the lookup context
|
// create the lookup context
|
||||||
debug_symbol_lookup_context *lookupContext
|
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);
|
ObjectDeleter<debug_symbol_lookup_context> contextDeleter(lookupContext);
|
||||||
|
|
||||||
// create and init symbol lookup
|
// create and init symbol lookup
|
||||||
SymbolLookup *lookup = new(nothrow) SymbolLookup(team);
|
SymbolLookup *lookup = new(std::nothrow) SymbolLookup(team);
|
||||||
if (!lookup)
|
if (lookup == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
ObjectDeleter<SymbolLookup> lookupDeleter(lookup);
|
||||||
|
|
||||||
status_t error = lookup->Init();
|
try {
|
||||||
if (error != B_OK) {
|
status_t error = lookup->Init();
|
||||||
delete lookup;
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
} catch (BPrivate::Debug::Exception exception) {
|
||||||
|
return exception.Error();
|
||||||
}
|
}
|
||||||
|
|
||||||
// everything went fine: return the result
|
// everything went fine: return the result
|
||||||
lookupContext->lookup = lookup;
|
lookupContext->lookup = lookup;
|
||||||
*_lookupContext = lookupContext;
|
*_lookupContext = lookupContext;
|
||||||
contextDeleter.Detach();
|
contextDeleter.Detach();
|
||||||
|
lookupDeleter.Detach();
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user