From 98471290f803d475c1bd4193fa5198b404a838cf Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 21 Jan 2022 14:33:54 +0900 Subject: [PATCH] Fix exeption handling of stub code of C generator - Add stub ptr check to the deregistration function - Change function call to g_rec_mutex_clear() in the registeration function Change-Id: I360083e4404e7935dd63eabbba540b3901ee9cd8 Signed-off-by: Hwankyu Jhun --- idlc/gen/c_stub_body_gen_cb.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/idlc/gen/c_stub_body_gen_cb.h b/idlc/gen/c_stub_body_gen_cb.h index 877485a..d9dc5e4 100644 --- a/idlc/gen/c_stub_body_gen_cb.h +++ b/idlc/gen/c_stub_body_gen_cb.h @@ -1043,7 +1043,7 @@ int __register(__callback_s *callback, void *user_da ret = rpc_port_stub_create(&__.stub, ""); if (ret != RPC_PORT_ERROR_NONE) { _E("Failed to create stub handle. error(%d)", ret); - __unregister(); + g_rec_mutex_clear(&__.mutex); return ret; } @@ -1087,6 +1087,9 @@ int __register(__callback_s *callback, void *user_da int __unregister(void) { + if (__.stub == nullptr) + return RPC_PORT_ERROR_NONE; + g_rec_mutex_lock(&__.mutex); g_rec_mutex_unlock(&__.mutex); g_rec_mutex_clear(&__.mutex); -- 2.7.4