mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-05 01:26:37 +00:00
scan-build: cleanup some warnings
Current cleanup is for unset values or variables that are not used anymore. Regarding ospfd/ospf_vty.c: argv_find() we'll never get it NULL, so get coststr = argv[idx]->arg;
This commit is contained in:
parent
80a5a11bb1
commit
c31a793b48
@ -279,8 +279,7 @@ babel_load_state_file(void)
|
|||||||
if(fd >= 0 && rc < 0) {
|
if(fd >= 0 && rc < 0) {
|
||||||
zlog_err("unlink(babel-state): %s", safe_strerror(errno));
|
zlog_err("unlink(babel-state): %s", safe_strerror(errno));
|
||||||
/* If we couldn't unlink it, it's probably stale. */
|
/* If we couldn't unlink it, it's probably stale. */
|
||||||
close(fd);
|
goto fini;
|
||||||
fd = -1;
|
|
||||||
}
|
}
|
||||||
if(fd >= 0) {
|
if(fd >= 0) {
|
||||||
char buf[100];
|
char buf[100];
|
||||||
@ -315,9 +314,12 @@ babel_load_state_file(void)
|
|||||||
zlog_err("Couldn't parse babel-state.");
|
zlog_err("Couldn't parse babel-state.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(fd);
|
goto fini;
|
||||||
fd = -1;
|
|
||||||
}
|
}
|
||||||
|
fini:
|
||||||
|
if (fd >= 0)
|
||||||
|
close(fd);
|
||||||
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1619,7 +1619,7 @@ static int zclient_read_sync_response(struct zclient *zclient,
|
|||||||
u_int16_t expected_cmd)
|
u_int16_t expected_cmd)
|
||||||
{
|
{
|
||||||
struct stream *s;
|
struct stream *s;
|
||||||
u_int16_t size;
|
u_int16_t size = -1;
|
||||||
u_char marker;
|
u_char marker;
|
||||||
u_char version;
|
u_char version;
|
||||||
vrf_id_t vrf_id;
|
vrf_id_t vrf_id;
|
||||||
|
@ -6075,12 +6075,11 @@ DEFUN (ip_ospf_cost,
|
|||||||
|
|
||||||
// get arguments
|
// get arguments
|
||||||
char *coststr = NULL, *ifaddr = NULL;
|
char *coststr = NULL, *ifaddr = NULL;
|
||||||
coststr = argv_find(argv, argc, "(1-65535)", &idx) ? argv[idx]->arg
|
argv_find(argv, argc, "(1-65535)", &idx);
|
||||||
: NULL;
|
coststr = argv[idx]->arg;
|
||||||
ifaddr = argv_find(argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL;
|
|
||||||
|
|
||||||
cost = strtol(coststr, NULL, 10);
|
cost = strtol(coststr, NULL, 10);
|
||||||
|
|
||||||
|
ifaddr = argv_find(argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL;
|
||||||
if (ifaddr) {
|
if (ifaddr) {
|
||||||
if (!inet_aton(ifaddr, &addr)) {
|
if (!inet_aton(ifaddr, &addr)) {
|
||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
|
@ -194,7 +194,7 @@ int pim_find_or_track_nexthop(struct pim_instance *pim, struct prefix *addr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (up != NULL)
|
if (up != NULL)
|
||||||
up = hash_get(pnc->upstream_hash, up, hash_alloc_intern);
|
hash_get(pnc->upstream_hash, up, hash_alloc_intern);
|
||||||
|
|
||||||
if (pnc && CHECK_FLAG(pnc->flags, PIM_NEXTHOP_VALID)) {
|
if (pnc && CHECK_FLAG(pnc->flags, PIM_NEXTHOP_VALID)) {
|
||||||
memcpy(out_pnc, pnc, sizeof(struct pim_nexthop_cache));
|
memcpy(out_pnc, pnc, sizeof(struct pim_nexthop_cache));
|
||||||
|
@ -304,6 +304,7 @@ static void addr2hostprefix(int af, const union g_addr *addr,
|
|||||||
prefix->u.prefix6 = addr->ipv6;
|
prefix->u.prefix6 = addr->ipv6;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
memset(prefix, 0, sizeof(*prefix));
|
||||||
zlog_warn("%s: unknown address family %d", __func__, af);
|
zlog_warn("%s: unknown address family %d", __func__, af);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user