[Libreoffice-commits] core.git: ucb/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Oct 21 05:07:45 UTC 2018
ucb/source/ucp/ftp/ftpurl.cxx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
New commits:
commit 86fd9622fb8066e1b3a41971cdf7ad76539d313c
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sat Oct 20 22:58:47 2018 +0200
Commit: Mike Kaganski <mike.kaganski at 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.kaganski at collabora.com>
Tested-by: Mike Kaganski <mike.kaganski at 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,
More information about the Libreoffice-commits
mailing list