Commit e3c6d9de authored by sbc's avatar sbc Committed by Commit bot

[NaCl SDK]: nacl_io: add nacl_io_uninit function.

Call this function on program shut down to allow
nacl_io to free its resources.  This fixes
all the "potential" leak reported by valgrind
--leak-check=full

Review URL: https://codereview.chromium.org/601963002

Cr-Commit-Position: refs/heads/master@{#296720}
parent 3695ffef
...@@ -12,6 +12,10 @@ void nacl_io_init() { ...@@ -12,6 +12,10 @@ void nacl_io_init() {
ki_init(NULL); ki_init(NULL);
} }
void nacl_io_uninit() {
ki_uninit();
}
void nacl_io_init_ppapi(PP_Instance instance, PPB_GetInterface get_interface) { void nacl_io_init_ppapi(PP_Instance instance, PPB_GetInterface get_interface) {
ki_init_ppapi(NULL, instance, get_interface); ki_init_ppapi(NULL, instance, get_interface);
} }
......
...@@ -51,6 +51,14 @@ void nacl_io_init(); ...@@ -51,6 +51,14 @@ void nacl_io_init();
*/ */
void nacl_io_init_ppapi(PP_Instance instance, PPB_GetInterface get_interface); void nacl_io_init_ppapi(PP_Instance instance, PPB_GetInterface get_interface);
/**
* Uninitialize nacl_io.
*
* This removes interception for POSIX C-library function and releases
* any associated resources.
*/
void nacl_io_uninit();
void nacl_io_set_exit_callback(nacl_io_exit_callback_t exit_callback, void nacl_io_set_exit_callback(nacl_io_exit_callback_t exit_callback,
void* user_data); void* user_data);
......
...@@ -43,5 +43,7 @@ int main(int argc, char* argv[]) { ...@@ -43,5 +43,7 @@ int main(int argc, char* argv[]) {
// By default, or if not running in the browser we simply run the main // By default, or if not running in the browser we simply run the main
// entry point directly, on the main thread. // entry point directly, on the main thread.
nacl_io_init(); nacl_io_init();
return PSUserMainGet()(argc, argv); int rtn = PSUserMainGet()(argc, argv);
nacl_io_uninit();
return rtn;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment