From 635ec3ce370b7ce4ac12b9c87b47c2c4f9768ce8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 13 Oct 2021 14:46:38 +0200 Subject: [PATCH] util/VarSize: use plain malloc() --- src/util/VarSize.hxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/VarSize.hxx b/src/util/VarSize.hxx index 000be6bc8..9b5ad4953 100644 --- a/src/util/VarSize.hxx +++ b/src/util/VarSize.hxx @@ -30,7 +30,6 @@ #ifndef MPD_VAR_SIZE_HXX #define MPD_VAR_SIZE_HXX -#include "Alloc.hxx" #include "Compiler.h" #include @@ -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)...);