[IOT-1643] Fix illegal memory access - Don't return local string 42/134142/1
authorGeorge Nash <george.nash@intel.com>
Thu, 1 Dec 2016 22:31:43 +0000 (14:31 -0800)
committerJooseok Park <jooseok.park@samsung.com>
Thu, 15 Jun 2017 03:23:41 +0000 (12:23 +0900)
commite39a0c80f57e5f3a4c857a17de2ec839bdeec7d2
tree32594da788a541c2cb6f997716094ceef615f4c3
parentfde73fe2bbb7d0e543aa899c6a78bf3f61caa80a
[IOT-1643] Fix illegal memory access - Don't return local string

the std::string ret  is a local varaible and is destroyed when the
what() member function returns.

Put the return string into the m_whatMessage variable. Since
'what()' member function is a const function it can not modify the
member variable m_whatMessage so it is generated in the
ResourceInitException constructor.

Issue found using static analysis tool.

Change-Id: I907b984f35dee59b2f300afe6a640b15a26f020f
Signed-off-by: George Nash <george.nash@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/15035
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Larry Sachs <larry.j.sachs@intel.com>
Reviewed-by: Habib Virji <habib.virji@samsung.com>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
resource/include/ResourceInitException.h