Skip to content

Commit 6196391

Browse files
committed
fabrics: do no try do disconnect invalid ctrl
The ctrl object (child) can be NULL when either discovery is false or _nvmf_discovery fails. Thus only disconnect when it is a valid pointer. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 5b5ac58 commit 6196391

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

libnvme/src/nvme/fabrics.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2253,7 +2253,7 @@ static int _nvmf_discovery(struct nvme_global_ctx *ctx,
22532253
if (discover)
22542254
_nvmf_discovery(ctx, fctx, true, child);
22552255

2256-
if (disconnect) {
2256+
if (child && disconnect) {
22572257
nvme_disconnect_ctrl(child);
22582258
nvme_free_ctrl(child);
22592259
}

0 commit comments

Comments
 (0)