From d4c14f5f05da740fece658b991c3ed61478c85e2 Mon Sep 17 00:00:00 2001 From: Minjae Lee Date: Wed, 20 Mar 2013 20:57:21 +0900 Subject: [PATCH 1/1] Patched, loopholes in the assingment operator Change-Id: Idcd39862e5edb51433795a9e9632a21ee7f6270d Signed-off-by: Minjae Lee --- src/FTelSimInfo.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/FTelSimInfo.cpp b/src/FTelSimInfo.cpp index 3c96ed9..039c75d 100644 --- a/src/FTelSimInfo.cpp +++ b/src/FTelSimInfo.cpp @@ -272,7 +272,22 @@ SimInfo::operator =(const SimInfo& rhs) { if (this != &rhs) { - *__pSimInfoImpl = *rhs.__pSimInfoImpl; + if (rhs.__pSimInfoImpl != null) + { + if (__pSimInfoImpl != null) + { + *__pSimInfoImpl = *rhs.__pSimInfoImpl; + } + else + { + __pSimInfoImpl = new (std::nothrow) _SimInfoImpl(*rhs.__pSimInfoImpl); + } + } + else + { + delete __pSimInfoImpl; + __pSimInfoImpl = null; + } } return *this; -- 2.7.4