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 Merged-In: I3493fd4764f8eacc86750e6414e62bc891abaccd
Loading
Please register or sign in to comment