prop_registry: fix memory leak of Json::Values

Using new in BoolArrayProperty::NewValue was allocating the values on
the heap but then immediately casting them to a reference that was
std::moved into the list, meaning that there was no way to deallocate
the Json::Values later. This appears to have been a one-off mistake, as
the similar code in DoubleArrayProperty::NewValue and
IntArrayProperty::NewValue create Json::Values and pass them as r-value
references, which is the fix here also.

This was detected by Address Sanitizer running PropRegistryTest
BoolArrayTest.

BUG=b:318520168
TEST=add -fsanitize=address to compiler flags, run unit tests [0], and
     check no address sanitization failures are reported from
     prop_registry_unittest.cc

[0]: cros_sdk env FEATURES="test" emerge-${BOARD} chromeos-base/gestures

Change-Id: Ifb40b04be26521ebb32caacb22376bd471b25f29
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/gestures/+/5318355
Tested-by: Harry Cutts <hcutts@chromium.org>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Commit-Queue: Harry Cutts <hcutts@chromium.org>
Reviewed-by: Kenneth Albanowski <kenalba@google.com>
Reviewed-by: Torsha Banerjee <torsha@google.com>
1 file changed