diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index be989cbabb..9c68fe5966 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -1546,8 +1546,11 @@ int send_hello(struct isis_circuit *circuit, int level) isis_tlvs_add_auth(tlvs, &circuit->passwd); - if (!listcount(circuit->area->area_addrs)) + if (!listcount(circuit->area->area_addrs)) { + isis_free_tlvs(tlvs); return ISIS_WARNING; + } + isis_tlvs_add_area_addresses(tlvs, circuit->area->area_addrs); if (circuit->circ_type == CIRCUIT_T_BROADCAST) diff --git a/lib/command.h b/lib/command.h index 8cccb62de3..e2d31decd4 100644 --- a/lib/command.h +++ b/lib/command.h @@ -380,6 +380,13 @@ extern void uninstall_element(enum node_type, struct cmd_element *); string with a space between each element (allocated using XMALLOC(MTYPE_TMP)). Returns NULL if shift >= argc. */ extern char *argv_concat(struct cmd_token **argv, int argc, int shift); + +/* + * It is preferred that you set the index initial value + * to a 0. This way in the future if you modify the + * cli then there is no need to modify the initial + * value of the index + */ extern int argv_find(struct cmd_token **argv, int argc, const char *text, int *index); diff --git a/lib/csv.c b/lib/csv.c index 136d77ae0b..27d0fe4029 100644 --- a/lib/csv.c +++ b/lib/csv.c @@ -284,8 +284,11 @@ csv_record_t *csv_encode_record(csv_t *csv, csv_record_t *rec, int count, ...) va_start(list, count); str = csv_field_iter(rec, &fld); - if (!fld) + if (!fld) { + va_end(list); return NULL; + } + for (tempc = 0; tempc < count; tempc++) { col = va_arg(list, char *); for (i = 0; i < fld->field_len; i++) { diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c index d1c1429054..699f2341d5 100644 --- a/ospfd/ospf_network.c +++ b/ospfd/ospf_network.c @@ -220,8 +220,10 @@ int ospf_sock_init(struct ospf *ospf) } ret = ospf_bind_vrfdevice(ospf, ospf_sock); - if (ret < 0) + if (ret < 0) { + close(ospf_sock); goto out; + } #ifdef IP_HDRINCL /* we will include IP header with packet */ @@ -232,6 +234,7 @@ int ospf_sock_init(struct ospf *ospf) zlog_warn("Can't set IP_HDRINCL option for fd %d: %s", ospf_sock, safe_strerror(save_errno)); + close(ospf_sock); goto out; } #elif defined(IPTOS_PREC_INTERNETCONTROL) diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index d5769c866e..69f6883186 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -659,6 +659,7 @@ static int ospf_router_info_lsa_originate1(void *arg) if (top == NULL) { zlog_debug("%s: ospf instance not found for vrf id %u", __PRETTY_FUNCTION__, vrf_id); + ospf_lsa_unlock(&new); return rc; } diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index 5f300dabae..392df5fb40 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -1167,8 +1167,10 @@ static struct ospf_lsa *ospf_mpls_te_lsa_new(struct ospf *ospf, tmp = SET_OPAQUE_LSID(OPAQUE_TYPE_INTER_AS_LSA, lp->instance); lsa_id.s_addr = htonl(tmp); - if (!ospf) + if (!ospf) { + stream_free(s); return NULL; + } lsa_header_set(s, options, lsa_type, lsa_id, ospf->router_id); } else { diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index bd944ae748..16f87735be 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -1134,12 +1134,16 @@ void ospf_distribute_list_update(struct ospf *ospf, int type, /* External info does not exist. */ ext = ospf_external_lookup(type, instance); - if (!ext || !(rt = EXTERNAL_INFO(ext))) + if (!ext || !(rt = EXTERNAL_INFO(ext))) { + XFREE(MTYPE_OSPF_DIST_ARGS, args); return; + } /* If exists previously invoked thread, then let it continue. */ - if (ospf->t_distribute_update) + if (ospf->t_distribute_update) { + XFREE(MTYPE_OSPF_DIST_ARGS, args); return; + } /* Set timer. */ ospf->t_distribute_update = NULL; diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 3e04167118..ed1d6a8195 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -6522,7 +6522,7 @@ DEFUN(interface_no_ip_pim_boundary_oil, { VTY_DECLVAR_CONTEXT(interface, iif); struct pim_interface *pim_ifp; - int idx; + int idx = 0; argv_find(argv, argc, "WORD", &idx);