Skip to content

Commit f70bdb0

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 60097ad commit f70bdb0

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
@@ -2256,7 +2256,7 @@ static int _nvmf_discovery(struct nvme_global_ctx *ctx,
22562256
if (discover)
22572257
_nvmf_discovery(ctx, fctx, true, child);
22582258

2259-
if (disconnect) {
2259+
if (child && disconnect) {
22602260
nvme_disconnect_ctrl(child);
22612261
nvme_free_ctrl(child);
22622262
}

0 commit comments

Comments
 (0)