[haiku-commits] haiku: hrev53384 - src/system/libroot/posix/rpmalloc

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 17 Aug 2019 12:29:51 -0400 (EDT)

hrev53384 adds 1 changeset to branch 'master'
old head: cc7e844c12cbb4d60c80edac08a503d5cf872929
new head: f70930539e5f43e30f4fa4596a75d31c3975426f
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=f70930539e5f+%5Ecc7e844c12cb

----------------------------------------------------------------------------

f70930539e5f: rpmalloc: Add missing NULL checks to the allocation paths.
  
  Fixes #15258.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53384
Commit:      f70930539e5f43e30f4fa4596a75d31c3975426f
URL:         https://git.haiku-os.org/haiku/commit/?id=f70930539e5f
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sat Aug 17 16:29:20 2019 UTC

Ticket:      https://dev.haiku-os.org/ticket/15258

----------------------------------------------------------------------------

1 file changed, 6 insertions(+)
src/system/libroot/posix/rpmalloc/rpmalloc.cpp | 6 ++++++

----------------------------------------------------------------------------

diff --git a/src/system/libroot/posix/rpmalloc/rpmalloc.cpp 
b/src/system/libroot/posix/rpmalloc/rpmalloc.cpp
index 9dd58108f3..4fd7fb9e9d 100644
--- a/src/system/libroot/posix/rpmalloc/rpmalloc.cpp
+++ b/src/system/libroot/posix/rpmalloc/rpmalloc.cpp
@@ -1351,6 +1351,9 @@ _memory_allocate_from_heap_fallback(heap_t* heap, 
uint32_t class_idx) {
        //Find a span in one of the cache levels
        active_span = _memory_heap_extract_new_span(heap, 1, class_idx);
 
+       if (!active_span)
+               return active_span;
+
        //Mark span as owned by this heap and set base data, return first block
        return _memory_span_set_new_active(heap, heap_class, active_span, 
class_idx);
 }
@@ -1393,6 +1396,9 @@ _memory_allocate_large(heap_t* heap, size_t size) {
        //Find a span in one of the cache levels
        span_t* span = _memory_heap_extract_new_span(heap, span_count, 
SIZE_CLASS_COUNT);
 
+       if (!span)
+               return span;
+
        //Mark span as owned by this heap and set base data
        assert(span->span_count == span_count);
        span->size_class = (uint32_t)(SIZE_CLASS_COUNT + idx);


Other related posts:

  • » [haiku-commits] haiku: hrev53384 - src/system/libroot/posix/rpmalloc - waddlesplash