summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-11-04 16:07:36 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-11-04 18:09:26 +0100
commitf89c72437b9db889148258f489669587372a2bd1 (patch)
tree6871e2a54de14e4c5f2ce28f75b843662848747a /vcl
parent41707751a60a8044d49896b0e62d9fe0e997af85 (diff)
coverity#1440844 Uninitialized pointer read
Change-Id: I5ae1c023bfff4f5d45f8ea8104a58dbd89a5d983 Reviewed-on: https://gerrit.libreoffice.org/62852 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/impglyphitem.cxx12
1 files changed, 9 insertions, 3 deletions
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;
}