[Libreoffice-commits] core.git: vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Nov 4 17:10:13 UTC 2018


 vcl/source/gdi/impglyphitem.cxx |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit f89c72437b9db889148258f489669587372a2bd1
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Nov 4 16:07:36 2018 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Nov 4 18:09:26 2018 +0100

    coverity#1440844 Uninitialized pointer read
    
    Change-Id: I5ae1c023bfff4f5d45f8ea8104a58dbd89a5d983
    Reviewed-on: https://gerrit.libreoffice.org/62852
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 55b1fbd5136e..809b70bc91bc 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -30,12 +30,18 @@ SalLayoutGlyphs::SalLayoutGlyphs()
 
 SalLayoutGlyphs::~SalLayoutGlyphs() { delete m_pImpl; }
 
-SalLayoutGlyphs::SalLayoutGlyphs(const SalLayoutGlyphs& rOther) { operator=(rOther); }
+SalLayoutGlyphs::SalLayoutGlyphs(const SalLayoutGlyphs& rOther)
+{
+    m_pImpl = rOther.m_pImpl ? rOther.m_pImpl->clone(*this) : nullptr;
+}
 
 SalLayoutGlyphs& SalLayoutGlyphs::operator=(const SalLayoutGlyphs& rOther)
 {
-    delete m_pImpl;
-    m_pImpl = rOther.m_pImpl ? rOther.m_pImpl->clone(*this) : nullptr;
+    if (this != &rOther)
+    {
+        delete m_pImpl;
+        m_pImpl = rOther.m_pImpl ? rOther.m_pImpl->clone(*this) : nullptr;
+    }
     return *this;
 }
 


More information about the Libreoffice-commits mailing list