From 2d582244680e7f6dec6e4a466e276f93ccb01dc9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 10 Aug 2020 20:47:32 +0200 Subject: loplugin:flatten Change-Id: I6560756eb63856a22b43e3e65a7b7843cd2d5376 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100447 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sax/source/tools/fastattribs.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sax') diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx index 3df391c86150..c021e892f91e 100644 --- a/sax/source/tools/fastattribs.cxx +++ b/sax/source/tools/fastattribs.cxx @@ -85,13 +85,13 @@ void FastAttributeList::add( sal_Int32 nToken, const char* pValue, size_t nValue if (maAttributeValues.back() > mnChunkLength) { const sal_Int32 newLen = std::max(mnChunkLength * 2, maAttributeValues.back()); - if (auto p = static_cast(realloc(mpChunk, newLen))) - { - mnChunkLength = newLen; - mpChunk = p; - } - else + auto p = static_cast(realloc(mpChunk, newLen)); + if (!p) throw std::bad_alloc(); + + mnChunkLength = newLen; + mpChunk = p; + } strncpy(mpChunk + nWritePosition, pValue, nValueLength); mpChunk[nWritePosition + nValueLength] = '\0'; -- cgit