mirror of
https://github.com/gperftools/gperftools
synced 2025-01-02 20:52:03 +00:00
don't return raw span when sampling and stacktrace oomed
This is nearly impossible in practice, but still. Somehow we missed this logic that DoSampledAllocation always returns actual object, but in that condition where stacktrace_allocator failed to get us StackTrace object we ended up returning span instead of it's object.
This commit is contained in:
parent
59464404d1
commit
d2c89ba534
@ -1177,14 +1177,12 @@ static void* DoSampledAllocation(size_t size) {
|
||||
|
||||
// Allocate stack trace
|
||||
StackTrace *stack = Static::stacktrace_allocator()->New();
|
||||
if (PREDICT_FALSE(stack == NULL)) {
|
||||
// Sampling failed because of lack of memory
|
||||
return span;
|
||||
}
|
||||
if (PREDICT_TRUE(stack != nullptr)) {
|
||||
*stack = tmp;
|
||||
span->sample = 1;
|
||||
span->objects = stack;
|
||||
tcmalloc::DLL_Prepend(Static::sampled_objects(), span);
|
||||
}
|
||||
|
||||
return SpanToMallocResult(span);
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user