From c584b84af90244277f091426858a74cedbdd892d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 24 Apr 2017 18:10:30 +0200 Subject: [PATCH] EVM-C: clarify that evm_result::release can be NULL --- examples/capi.c | 3 ++- include/evm.h | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/examples/capi.c b/examples/capi.c index 98a0e09..74cd6ac 100644 --- a/examples/capi.c +++ b/examples/capi.c @@ -98,6 +98,7 @@ int main(int argc, char *argv[]) { printf("\n"); } - result.release(&result); + if (result.release) + result.release(&result); jit->destroy(jit); } diff --git a/include/evm.h b/include/evm.h index ac3cf9b..0af7ae0 100644 --- a/include/evm.h +++ b/include/evm.h @@ -99,9 +99,13 @@ struct evm_result { /// The pointer to the result release implementation. /// - /// This function pointer must be set by the EVM implementation and works - /// similarly to C++ virtual destructor. Attaching the releaser to the - /// result itself allows EVM composition. + /// This function pointer may be set by the EVM implementation and must be + /// used by the user to release memory associated with the result object. + /// In case it is NULL the user does not have to release any resources. + /// + /// @note + /// It works similarly to C++ virtual destructor. Attaching the release + /// function to the result itself allows EVM composition. evm_release_result_fn release; /// The pointer to EVM-owned memory. For EVM internal use.