[MDEV-21337] fix aligned_malloc() Created: 2019-12-17  Updated: 2020-08-25  Resolved: 2019-12-18

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.1, 10.2, 10.3, 10.4
Fix Version/s: 10.1.44, 10.2.31, 10.3.22, 10.4.12

Type: Bug Priority: Major
Reporter: Eugene Kosov (Inactive) Assignee: Eugene Kosov (Inactive)
Resolution: Fixed Votes: 0
Labels: None


 Description   

inline void* aligned_malloc(size_t size, size_t align) {
    void *result;
#ifdef _MSC_VER
    result = _aligned_malloc(size, align);
#elif defined (HAVE_POSIX_MEMALIGN)
    if(posix_memalign(&result, align, size)) {
	    result = 0;
    }
#else
    /* Use unaligned malloc as fallback */
    result = malloc(size);
#endif
    return result;
}

This function should always return aligned buffer, as it's name states.


Generated at Thu Feb 08 09:06:22 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.