lib/nvmf: destroy the mutex properly
In the both normal and exceptional case, the mutex will need to be destroyed. Change-Id: I39c815f2adffbd3786b45a938c476dcbb66a438f Signed-off-by: GangCao <gang.cao@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4339 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: JinYu <jin.yu@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
fa1cfaa659
commit
6bc1f09f61
@ -297,6 +297,7 @@ spdk_nvmf_tgt_create(struct spdk_nvmf_target_opts *opts)
|
||||
|
||||
tgt->accept_poller = SPDK_POLLER_REGISTER(nvmf_tgt_accept, tgt, acceptor_poll_rate);
|
||||
if (!tgt->accept_poller) {
|
||||
pthread_mutex_destroy(&tgt->mutex);
|
||||
free(tgt->subsystems);
|
||||
free(tgt);
|
||||
return NULL;
|
||||
@ -340,6 +341,7 @@ nvmf_tgt_destroy_cb(void *io_device)
|
||||
destroy_cb_fn = tgt->destroy_cb_fn;
|
||||
destroy_cb_arg = tgt->destroy_cb_arg;
|
||||
|
||||
pthread_mutex_destroy(&tgt->mutex);
|
||||
free(tgt);
|
||||
|
||||
if (destroy_cb_fn) {
|
||||
|
Loading…
Reference in New Issue
Block a user