util/VarSize: use plain malloc()

This commit is contained in:
Max Kellermann 2021-10-13 14:46:38 +02:00
parent 8e71130e8a
commit 635ec3ce37

View File

@ -30,7 +30,6 @@
#ifndef MPD_VAR_SIZE_HXX
#define MPD_VAR_SIZE_HXX
#include "Alloc.hxx"
#include "Compiler.h"
#include <type_traits>
@ -61,7 +60,9 @@ NewVarSize(size_t declared_tail_size, size_t real_tail_size, Args&&... args)
size_t size = sizeof(T) - declared_tail_size + real_tail_size;
/* allocate memory */
T *instance = (T *)xalloc(size);
T *instance = (T *)malloc(size);
if (instance == nullptr)
throw std::bad_alloc{};
/* call the constructor */
new(instance) T(std::forward<Args>(args)...);