platform_hardware_interfaces/neuralnetworks/1.1/utils
Michael Butler 7ecc290745 Move NN_TRY macro out of struct initialization
NNAPI NN_TRY macros use Statement Expressions (a GNU extension) to
propagate errors. However, a "return" statement in a Statement
Expression can lead to memory leaks when the Statement Expression is
being used to initialize a member of a struct. Specifically, when one member of a struct is already initialized, and a Statement Expression used to initialize a subsequent member early-returns, the previously initialized members will not have their destructors called.

This CL moves any NN_TRY macro out of struct initialization to avoid any
potential memory leaks.

Bug: 230500484
Test: mma
Test: presubmit
Change-Id: I3493fd4764f8eacc86750e6414e62bc891abaccd
2022-04-28 22:05:37 +00:00
..
include/nnapi/hal/1.1 HAL interface for compilation and execution hints 2022-01-20 16:48:40 +00:00
src Move NN_TRY macro out of struct initialization 2022-04-28 22:05:37 +00:00
test HAL interface for compilation and execution hints 2022-01-20 16:48:40 +00:00
Android.bp Cleanup NN utility libraries' dependencies 2022-01-20 12:31:38 -08:00