nvme: set qpair fields to NULL during destruct
Avoid potential double free cases. This fixes a clang warning during scan-build. Change-Id: I487d6fcd485d1f8ebb96b6f8cb54511628461f39 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
dfc4b030b1
commit
59ae518add
@ -590,12 +590,18 @@ nvme_qpair_destroy(struct spdk_nvme_qpair *qpair)
|
||||
if (nvme_qpair_is_admin_queue(qpair)) {
|
||||
_nvme_admin_qpair_destroy(qpair);
|
||||
}
|
||||
if (qpair->cmd && !qpair->sq_in_cmb)
|
||||
if (qpair->cmd && !qpair->sq_in_cmb) {
|
||||
nvme_free(qpair->cmd);
|
||||
if (qpair->cpl)
|
||||
qpair->cmd = NULL;
|
||||
}
|
||||
if (qpair->cpl) {
|
||||
nvme_free(qpair->cpl);
|
||||
if (qpair->tr)
|
||||
qpair->cpl = NULL;
|
||||
}
|
||||
if (qpair->tr) {
|
||||
nvme_free(qpair->tr);
|
||||
qpair->tr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
x
Reference in New Issue
Block a user