Changeset aca1777 in mainline for kernel/generic/src/mm/malloc.c


Ignore:
Timestamp:
2025-05-08T17:12:05Z (3 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
2f21cd4
Parents:
1cfce3f (diff), 61f28c4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge upstream into helenraid

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/malloc.c

    r1cfce3f raca1777  
    190190                return NULL;
    191191
    192         void *obj = mem_alloc(alignof(max_align_t), size + _offset) + _offset;
     192        void *obj = mem_alloc(alignof(max_align_t), size + _offset);
     193        if (!obj)
     194                return NULL;
     195
     196        obj += _offset;
    193197
    194198        /* Remember the allocation size just before the object. */
     
    205209         * slab_free() will detect it and panic.
    206210         */
    207         size_t size = ((size_t *) obj)[-1];
    208         mem_free(obj - _offset, alignof(max_align_t), size + _offset);
     211        if (obj) {
     212                size_t size = ((size_t *) obj)[-1];
     213                mem_free(obj - _offset, alignof(max_align_t), size + _offset);
     214        }
    209215}
    210216
Note: See TracChangeset for help on using the changeset viewer.