Skip to content

Commit f020e16

Browse files
authored
Merge pull request #299 from tbzatek/covscan-fixes-1
Misc. static analyzer fixes
2 parents 746cfc0 + dc22346 commit f020e16

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/nvme/fabrics.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ nvme_ctrl_t nvmf_connect_disc_entry(nvme_host_t h,
593593
errno = EINVAL;
594594
return NULL;
595595
}
596+
break;
596597
case NVMF_TRTYPE_LOOP:
597598
nvme_chomp(e->traddr, NVMF_TRADDR_SIZE);
598599
traddr = strlen(e->traddr) ? e->traddr : NULL;
@@ -638,6 +639,7 @@ nvme_ctrl_t nvmf_connect_disc_entry(nvme_host_t h,
638639
}
639640

640641
if (nvme_ctrl_is_discovered(c)) {
642+
nvme_free_ctrl(c);
641643
errno = EAGAIN;
642644
return NULL;
643645
}

src/nvme/tree.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,11 +1023,12 @@ nvme_ctrl_t nvme_lookup_ctrl(nvme_subsystem_t s, const char *transport,
10231023
const char *host_iface, const char *trsvcid,
10241024
nvme_ctrl_t p)
10251025
{
1026-
nvme_root_t r = s->h ? s->h->r : NULL;
1026+
nvme_root_t r;
10271027
struct nvme_ctrl *c;
10281028

10291029
if (!s || !transport)
10301030
return NULL;
1031+
r = s->h ? s->h->r : NULL;
10311032
c = p ? nvme_subsystem_next_ctrl(s, p) : nvme_subsystem_first_ctrl(s);
10321033
for (; c != NULL; c = nvme_subsystem_next_ctrl(s, c)) {
10331034
if (strcmp(c->transport, transport))
@@ -1887,9 +1888,9 @@ struct nvme_ns *nvme_subsystem_lookup_namespace(struct nvme_subsystem *s,
18871888
if (ret < 0)
18881889
return NULL;
18891890
n = __nvme_scan_namespace(s->sysfs_dir, name);
1891+
free(name);
18901892
if (!n) {
18911893
nvme_msg(r, LOG_DEBUG, "failed to scan namespace %d\n", nsid);
1892-
free(name);
18931894
return NULL;
18941895
}
18951896

0 commit comments

Comments
 (0)