mesh: Fix double-free 31/234231/1 accepted/tizen/unified/20200529.124353 submit/tizen/20200527.022320
authorBrian Gix <brian.gix@intel.com>
Wed, 20 May 2020 22:14:38 +0000 (15:14 -0700)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Fri, 22 May 2020 04:23:44 +0000 (09:53 +0530)
commitafb80eafa05395a867612ee811f5d13779e2b849
treeb60ce54a6e5a57e8f7e5f019993c2fbe01c77968
parent6d9e9d73e3023ee7333a8f94dfbc251d833b1d35
mesh: Fix double-free

This fixes a double-free error when destroying the NVM storage of a mesh node.
Cleanly handle two distinct scenarios:

1. When the node is being deleted at runtime.  This causes release of
   both dynamic memory and NVM storage.

2. During shutdown, we release dynamic memory only.

Change-Id: Ib69263c627e08f396d2f5dacbc04b4cfe0aace35
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
mesh/mesh-config-json.c
mesh/mesh-config.h
mesh/node.c