Skip to content

Commit 0fdc719

Browse files
committed
MDF [conf] Release ACL cache related resources to avoid memory leaks
Signed-off-by: Moi Ran <maoyi.ran@emqx.io>
1 parent 6880285 commit 0fdc719

File tree

1 file changed

+15
-0
lines changed
  • src/supplemental/nanolib

1 file changed

+15
-0
lines changed

src/supplemental/nanolib/conf.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4378,6 +4378,21 @@ conf_auth_http_destroy(conf_auth_http *auth_http)
43784378
conf_auth_http_req_destroy(&auth_http->auth_req);
43794379
conf_auth_http_req_destroy(&auth_http->super_req);
43804380
conf_auth_http_req_destroy(&auth_http->acl_req);
4381+
4382+
// Release ACL cache related resources to avoid memory leaks.
4383+
if (auth_http->acl_cache_reset_aio != NULL) {
4384+
nng_aio_stop(auth_http->acl_cache_reset_aio);
4385+
nng_aio_free(auth_http->acl_cache_reset_aio);
4386+
auth_http->acl_cache_reset_aio = NULL;
4387+
}
4388+
if (auth_http->acl_cache_map != NULL) {
4389+
nng_id_map_free(auth_http->acl_cache_map);
4390+
auth_http->acl_cache_map = NULL;
4391+
}
4392+
if (auth_http->acl_cache_mtx != NULL) {
4393+
nng_mtx_free(auth_http->acl_cache_mtx);
4394+
auth_http->acl_cache_mtx = NULL;
4395+
}
43814396
}
43824397

43834398
static void

0 commit comments

Comments
 (0)