ucb/source/ucp/ftp/ftpurl.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
New commits: commit 86fd9622fb8066e1b3a41971cdf7ad76539d313c Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sat Oct 20 22:58:47 2018 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sun Oct 21 07:07:23 2018 +0200 tdf#120703 (PVS): handle failed realloc V701 realloc() possible leak: when realloc() fails in allocating memory, original pointer 'm_pBuffer' is lost. Consider assigning realloc() to a temporary pointer. Change-Id: I8a18e1472072456bfe9f32d822f185cabd24d6ed Reviewed-on: https://gerrit.libreoffice.org/62114 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx index 38e4afe3345a..01c2eb292860 100644 --- a/ucb/source/ucp/ftp/ftpurl.cxx +++ b/ucb/source/ucp/ftp/ftpurl.cxx @@ -88,7 +88,10 @@ int MemoryContainer::append( m_nLen+=1024; } while(m_nLen < tmp); - m_pBuffer = std::realloc(m_pBuffer,m_nLen); + if (auto p = std::realloc(m_pBuffer, m_nLen)) + m_pBuffer = p; + else + return 0; } memcpy(static_cast<sal_Int8*>(m_pBuffer)+m_nWritePos, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits