summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--babeld/babeld.c2
-rw-r--r--bfdd/control.c1
-rw-r--r--bgpd/bgp_advertise.c1
-rw-r--r--bgpd/bgp_community.c1
-rw-r--r--bgpd/bgp_dump.c10
-rw-r--r--bgpd/bgp_filter.c5
-rw-r--r--bgpd/bgp_lcommunity.c1
-rw-r--r--bgpd/bgp_main.c1
-rw-r--r--bgpd/bgp_mpath.c1
-rw-r--r--bgpd/bgp_open.c16
-rw-r--r--bgpd/bgp_packet.c3
-rw-r--r--bgpd/bgp_pbr.c1
-rw-r--r--bgpd/bgp_route.c10
-rw-r--r--bgpd/bgp_updgrp.c3
-rw-r--r--bgpd/bgp_zebra.c1
-rw-r--r--bgpd/bgpd.c101
-rw-r--r--bgpd/bgpd.h3
-rw-r--r--bgpd/rfapi/rfapi.c5
-rw-r--r--bgpd/rfapi/rfapi_encap_tlv.c1
-rw-r--r--eigrpd/eigrp_interface.c1
-rw-r--r--isisd/isis_bfd.c1
-rw-r--r--lib/bfd.c5
-rw-r--r--lib/command.c5
-rw-r--r--lib/distribute.c2
-rw-r--r--lib/filter.c5
-rw-r--r--lib/if.c1
-rw-r--r--lib/if_rmap.c2
-rw-r--r--lib/log.c1
-rw-r--r--lib/plist.c6
-rw-r--r--lib/prefix.c1
-rw-r--r--lib/routemap.c1
-rw-r--r--lib/vty.c11
-rw-r--r--nhrpd/nhrp_route.c1
-rw-r--r--nhrpd/nhrp_shortcut.c1
-rw-r--r--ospf6d/ospf6_message.c11
-rw-r--r--ospfd/ospf_asbr.c1
-rw-r--r--ospfd/ospf_interface.c1
-rw-r--r--pimd/pim_bsm.c3
-rw-r--r--pimd/pim_msdp.c4
-rw-r--r--ripd/rip_interface.c1
-rw-r--r--ripd/ripd.c3
-rw-r--r--ripngd/ripng_interface.c1
-rw-r--r--ripngd/ripngd.c3
-rw-r--r--tests/lib/test_heavy_wq.c1
-rw-r--r--vtysh/vtysh.c1
-rw-r--r--zebra/zebra_dplane.c1
-rw-r--r--zebra/zebra_mlag.c15
-rw-r--r--zebra/zebra_nhg.c1
-rw-r--r--zebra/zebra_rib.c2
49 files changed, 43 insertions, 217 deletions
diff --git a/babeld/babeld.c b/babeld/babeld.c
index 6ad004a4a4..71bab2fcbf 100644
--- a/babeld/babeld.c
+++ b/babeld/babeld.c
@@ -165,7 +165,6 @@ babel_create_routing_process (void)
return 0;
fail:
XFREE(MTYPE_BABEL, babel_routing_process);
- babel_routing_process = NULL;
return -1;
}
@@ -324,7 +323,6 @@ babel_clean_routing_process(void)
distribute_list_delete(&babel_routing_process->distribute_ctx);
XFREE(MTYPE_BABEL, babel_routing_process);
- babel_routing_process = NULL;
}
/* Function used with timeout. */
diff --git a/bfdd/control.c b/bfdd/control.c
index cf821f45b8..ae6f5a3e79 100644
--- a/bfdd/control.c
+++ b/bfdd/control.c
@@ -407,7 +407,6 @@ static void control_reset_buf(struct bfd_control_buffer *bcb)
{
/* Get ride of old data. */
XFREE(MTYPE_BFDD_NOTIFICATION, bcb->bcb_buf);
- bcb->bcb_buf = NULL;
bcb->bcb_pos = 0;
bcb->bcb_left = 0;
}
diff --git a/bgpd/bgp_advertise.c b/bgpd/bgp_advertise.c
index 76a65f7f04..8d1c83cf5f 100644
--- a/bgpd/bgp_advertise.c
+++ b/bgpd/bgp_advertise.c
@@ -256,6 +256,5 @@ void bgp_sync_delete(struct peer *peer)
FOREACH_AFI_SAFI (afi, safi) {
XFREE(MTYPE_BGP_SYNCHRONISE, peer->sync[afi][safi]);
- peer->sync[afi][safi] = NULL;
}
}
diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c
index 432c922ea5..496d7ed2b1 100644
--- a/bgpd/bgp_community.c
+++ b/bgpd/bgp_community.c
@@ -89,7 +89,6 @@ void community_del_val(struct community *com, uint32_t *val)
com->val, com_length(com));
else {
XFREE(MTYPE_COMMUNITY_VAL, com->val);
- com->val = NULL;
}
return;
}
diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c
index f850cb49cf..298f9d0212 100644
--- a/bgpd/bgp_dump.c
+++ b/bgpd/bgp_dump.c
@@ -667,10 +667,7 @@ static int bgp_dump_set(struct vty *vty, struct bgp_dump *bgp_dump,
static int bgp_dump_unset(struct bgp_dump *bgp_dump)
{
/* Removing file name. */
- if (bgp_dump->filename) {
- XFREE(MTYPE_BGP_DUMP_STR, bgp_dump->filename);
- bgp_dump->filename = NULL;
- }
+ XFREE(MTYPE_BGP_DUMP_STR, bgp_dump->filename);
/* Closing file. */
if (bgp_dump->fp) {
@@ -687,10 +684,7 @@ static int bgp_dump_unset(struct bgp_dump *bgp_dump)
bgp_dump->interval = 0;
/* Removing interval string. */
- if (bgp_dump->interval_str) {
- XFREE(MTYPE_BGP_DUMP_STR, bgp_dump->interval_str);
- bgp_dump->interval_str = NULL;
- }
+ XFREE(MTYPE_BGP_DUMP_STR, bgp_dump->interval_str);
return CMD_SUCCESS;
}
diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c
index f08f9b2fb7..a03551e79d 100644
--- a/bgpd/bgp_filter.c
+++ b/bgpd/bgp_filter.c
@@ -168,10 +168,7 @@ static struct as_list *as_list_new(void)
static void as_list_free(struct as_list *aslist)
{
- if (aslist->name) {
- XFREE(MTYPE_AS_STR, aslist->name);
- aslist->name = NULL;
- }
+ XFREE(MTYPE_AS_STR, aslist->name);
XFREE(MTYPE_AS_LIST, aslist);
}
diff --git a/bgpd/bgp_lcommunity.c b/bgpd/bgp_lcommunity.c
index 674686b3c4..f889693001 100644
--- a/bgpd/bgp_lcommunity.c
+++ b/bgpd/bgp_lcommunity.c
@@ -527,7 +527,6 @@ void lcommunity_del_val(struct lcommunity *lcom, uint8_t *ptr)
lcom->val, lcom_length(lcom));
else {
XFREE(MTYPE_LCOMMUNITY_VAL, lcom->val);
- lcom->val = NULL;
}
return;
}
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index fab2a584c0..898c35e4ef 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -272,7 +272,6 @@ static int bgp_vrf_enable(struct vrf *vrf)
if (bgp && bgp->vrf_id != vrf->vrf_id) {
if (bgp->name && strmatch(vrf->name, VRF_DEFAULT_NAME)) {
XFREE(MTYPE_BGP, bgp->name);
- bgp->name = NULL;
XFREE(MTYPE_BGP, bgp->name_pretty);
bgp->name_pretty = XSTRDUP(MTYPE_BGP, "VRF default");
bgp->inst_type = BGP_INSTANCE_TYPE_DEFAULT;
diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c
index 77448ec15d..cc7bd6e7c7 100644
--- a/bgpd/bgp_mpath.c
+++ b/bgpd/bgp_mpath.c
@@ -280,7 +280,6 @@ void bgp_path_info_mpath_free(struct bgp_path_info_mpath **mpath)
if ((*mpath)->mp_attr)
bgp_attr_unintern(&(*mpath)->mp_attr);
XFREE(MTYPE_BGP_MPATH_INFO, *mpath);
- *mpath = NULL;
}
}
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 70ae7d8706..54d785e26b 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -710,15 +710,8 @@ static int bgp_capability_hostname(struct peer *peer,
if (len) {
str[len] = '\0';
- if (peer->hostname != NULL) {
- XFREE(MTYPE_BGP_PEER_HOST, peer->hostname);
- peer->hostname = NULL;
- }
-
- if (peer->domainname != NULL) {
- XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
- peer->domainname = NULL;
- }
+ XFREE(MTYPE_BGP_PEER_HOST, peer->hostname);
+ XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
peer->hostname = XSTRDUP(MTYPE_BGP_PEER_HOST, str);
}
@@ -750,10 +743,7 @@ static int bgp_capability_hostname(struct peer *peer,
if (len) {
str[len] = '\0';
- if (peer->domainname != NULL) {
- XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
- peer->domainname = NULL;
- }
+ XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
peer->domainname = XSTRDUP(MTYPE_BGP_PEER_HOST, str);
}
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index e77194a624..02f0ecf2fd 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -752,7 +752,6 @@ void bgp_notify_send_with_data(struct peer *peer, uint8_t code,
if (bgp_notify.data) {
XFREE(MTYPE_TMP, bgp_notify.data);
- bgp_notify.data = NULL;
bgp_notify.length = 0;
}
}
@@ -1745,7 +1744,6 @@ static int bgp_notify_receive(struct peer *peer, bgp_size_t size)
if (peer->notify.data) {
XFREE(MTYPE_TMP, peer->notify.data);
- peer->notify.data = NULL;
peer->notify.length = 0;
}
@@ -1796,7 +1794,6 @@ static int bgp_notify_receive(struct peer *peer, bgp_size_t size)
bgp_notify_print(peer, &bgp_notify, "received");
if (bgp_notify.data) {
XFREE(MTYPE_TMP, bgp_notify.data);
- bgp_notify.data = NULL;
bgp_notify.length = 0;
}
}
diff --git a/bgpd/bgp_pbr.c b/bgpd/bgp_pbr.c
index 14f5fefb20..9ced99616b 100644
--- a/bgpd/bgp_pbr.c
+++ b/bgpd/bgp_pbr.c
@@ -1260,7 +1260,6 @@ void bgp_pbr_cleanup(struct bgp *bgp)
return;
bgp_pbr_reset(bgp, AFI_IP);
XFREE(MTYPE_PBR, bgp->bgp_pbr_cfg);
- bgp->bgp_pbr_cfg = NULL;
}
void bgp_pbr_init(struct bgp *bgp)
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 66aa0da745..983b0184a5 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -235,8 +235,6 @@ void bgp_path_info_extra_free(struct bgp_path_info_extra **extra)
if ((*extra)->bgp_fs_pbr)
list_delete(&((*extra)->bgp_fs_pbr));
XFREE(MTYPE_BGP_ROUTE_EXTRA, *extra);
-
- *extra = NULL;
}
/* Get bgp_path_info extra information for the given bgp_path_info, lazy
@@ -5469,7 +5467,6 @@ static int bgp_static_set(struct vty *vty, const char *negate,
bgp_static->rmap.name);
route_map_counter_decrement(
bgp_static->rmap.map);
- bgp_static->rmap.name = NULL;
bgp_static->rmap.map = NULL;
bgp_static->valid = 0;
}
@@ -5891,7 +5888,6 @@ static int bgp_table_map_set(struct vty *vty, afi_t afi, safi_t safi,
} else {
XFREE(MTYPE_ROUTE_MAP_NAME, rmap->name);
route_map_counter_decrement(rmap->map);
- rmap->name = NULL;
rmap->map = NULL;
}
@@ -5910,7 +5906,6 @@ static int bgp_table_map_unset(struct vty *vty, afi_t afi, safi_t safi,
rmap = &bgp->table_map[afi][safi];
XFREE(MTYPE_ROUTE_MAP_NAME, rmap->name);
route_map_counter_decrement(rmap->map);
- rmap->name = NULL;
rmap->map = NULL;
if (bgp_fibupd_safi(safi))
@@ -12191,10 +12186,7 @@ static int bgp_distance_set(struct vty *vty, const char *distance_str,
bdistance->distance = distance;
/* Reset access-list configuration. */
- if (bdistance->access_list) {
- XFREE(MTYPE_AS_LIST, bdistance->access_list);
- bdistance->access_list = NULL;
- }
+ XFREE(MTYPE_AS_LIST, bdistance->access_list);
if (access_list_str)
bdistance->access_list =
XSTRDUP(MTYPE_AS_LIST, access_list_str);
diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c
index 5b3eb2c719..3dbc675212 100644
--- a/bgpd/bgp_updgrp.c
+++ b/bgpd/bgp_updgrp.c
@@ -111,7 +111,6 @@ static void sync_init(struct update_subgroup *subgrp)
static void sync_delete(struct update_subgroup *subgrp)
{
XFREE(MTYPE_BGP_SYNCHRONISE, subgrp->sync);
- subgrp->sync = NULL;
if (subgrp->hash)
hash_free(subgrp->hash);
subgrp->hash = NULL;
@@ -220,7 +219,6 @@ static void conf_release(struct peer *src, afi_t afi, safi_t safi)
XFREE(MTYPE_BGP_FILTER_NAME, srcfilter->usmap.name);
XFREE(MTYPE_BGP_PEER_HOST, src->host);
- src->host = NULL;
}
static void peer2_updgrp_copy(struct update_group *updgrp, struct peer_af *paf)
@@ -735,7 +733,6 @@ static void update_group_delete(struct update_group *updgrp)
conf_release(updgrp->conf, updgrp->afi, updgrp->safi);
XFREE(MTYPE_BGP_PEER_HOST, updgrp->conf->host);
- updgrp->conf->host = NULL;
XFREE(MTYPE_BGP_PEER_IFNAME, updgrp->conf->ifname);
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index ccb888cf53..0e7a361edc 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -1779,7 +1779,6 @@ int bgp_redistribute_unset(struct bgp *bgp, afi_t afi, int type,
/* Unset route-map. */
XFREE(MTYPE_ROUTE_MAP_NAME, red->rmap.name);
route_map_counter_decrement(red->rmap.map);
- red->rmap.name = NULL;
red->rmap.map = NULL;
/* Unset metric. */
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 29ae0c109d..2117baf835 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -1007,26 +1007,10 @@ static void peer_free(struct peer *peer)
XFREE(MTYPE_PEER_TX_SHUTDOWN_MSG, peer->tx_shutdown_message);
- if (peer->desc) {
- XFREE(MTYPE_PEER_DESC, peer->desc);
- peer->desc = NULL;
- }
-
- /* Free allocated host character. */
- if (peer->host) {
- XFREE(MTYPE_BGP_PEER_HOST, peer->host);
- peer->host = NULL;
- }
-
- if (peer->domainname) {
- XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
- peer->domainname = NULL;
- }
-
- if (peer->ifname) {
- XFREE(MTYPE_BGP_PEER_IFNAME, peer->ifname);
- peer->ifname = NULL;
- }
+ XFREE(MTYPE_PEER_DESC, peer->desc);
+ XFREE(MTYPE_BGP_PEER_HOST, peer->host);
+ XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
+ XFREE(MTYPE_BGP_PEER_IFNAME, peer->ifname);
/* Update source configuration. */
if (peer->update_source) {
@@ -1034,10 +1018,7 @@ static void peer_free(struct peer *peer)
peer->update_source = NULL;
}
- if (peer->update_if) {
- XFREE(MTYPE_PEER_UPDATE_SOURCE, peer->update_if);
- peer->update_if = NULL;
- }
+ XFREE(MTYPE_PEER_UPDATE_SOURCE, peer->update_if);
XFREE(MTYPE_TMP, peer->notify.data);
memset(&peer->notify, 0, sizeof(struct bgp_notify));
@@ -1047,10 +1028,7 @@ static void peer_free(struct peer *peer)
bgp_sync_delete(peer);
- if (peer->conf_if) {
- XFREE(MTYPE_PEER_CONF_IF, peer->conf_if);
- peer->conf_if = NULL;
- }
+ XFREE(MTYPE_PEER_CONF_IF, peer->conf_if);
bfd_info_free(&(peer->bfd_info));
@@ -1370,10 +1348,7 @@ void peer_xfer_config(struct peer *peer_dst, struct peer *peer_src)
if (peer_src->update_source) {
if (peer_dst->update_source)
sockunion_free(peer_dst->update_source);
- if (peer_dst->update_if) {
- XFREE(MTYPE_PEER_UPDATE_SOURCE, peer_dst->update_if);
- peer_dst->update_if = NULL;
- }
+ XFREE(MTYPE_PEER_UPDATE_SOURCE, peer_dst->update_if);
peer_dst->update_source =
sockunion_dup(peer_src->update_source);
} else if (peer_src->update_if) {
@@ -2385,57 +2360,24 @@ int peer_delete(struct peer *peer)
filter = &peer->filter[afi][safi];
for (i = FILTER_IN; i < FILTER_MAX; i++) {
- if (filter->dlist[i].name) {
- XFREE(MTYPE_BGP_FILTER_NAME,
- filter->dlist[i].name);
- filter->dlist[i].name = NULL;
- }
-
- if (filter->plist[i].name) {
- XFREE(MTYPE_BGP_FILTER_NAME,
- filter->plist[i].name);
- filter->plist[i].name = NULL;
- }
-
- if (filter->aslist[i].name) {
- XFREE(MTYPE_BGP_FILTER_NAME,
- filter->aslist[i].name);
- filter->aslist[i].name = NULL;
- }
+ XFREE(MTYPE_BGP_FILTER_NAME, filter->dlist[i].name);
+ XFREE(MTYPE_BGP_FILTER_NAME, filter->plist[i].name);
+ XFREE(MTYPE_BGP_FILTER_NAME, filter->aslist[i].name);
}
for (i = RMAP_IN; i < RMAP_MAX; i++) {
- if (filter->map[i].name) {
- XFREE(MTYPE_BGP_FILTER_NAME,
- filter->map[i].name);
- filter->map[i].name = NULL;
- }
+ XFREE(MTYPE_BGP_FILTER_NAME, filter->map[i].name);
}
- if (filter->usmap.name) {
- XFREE(MTYPE_BGP_FILTER_NAME, filter->usmap.name);
- filter->usmap.name = NULL;
- }
-
- if (peer->default_rmap[afi][safi].name) {
- XFREE(MTYPE_ROUTE_MAP_NAME,
- peer->default_rmap[afi][safi].name);
- peer->default_rmap[afi][safi].name = NULL;
- }
+ XFREE(MTYPE_BGP_FILTER_NAME, filter->usmap.name);
+ XFREE(MTYPE_ROUTE_MAP_NAME, peer->default_rmap[afi][safi].name);
}
FOREACH_AFI_SAFI (afi, safi)
peer_af_delete(peer, afi, safi);
- if (peer->hostname) {
- XFREE(MTYPE_BGP_PEER_HOST, peer->hostname);
- peer->hostname = NULL;
- }
-
- if (peer->domainname) {
- XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
- peer->domainname = NULL;
- }
+ XFREE(MTYPE_BGP_PEER_HOST, peer->hostname);
+ XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
peer_unlock(peer); /* initial reference */
@@ -2992,18 +2934,12 @@ static struct bgp *bgp_create(as_t *as, const char *name,
XFREE(MTYPE_BGP_PEER_HOST, bgp->peer_self->host);
bgp->peer_self->host =
XSTRDUP(MTYPE_BGP_PEER_HOST, "Static announcement");
- if (bgp->peer_self->hostname != NULL) {
- XFREE(MTYPE_BGP_PEER_HOST, bgp->peer_self->hostname);
- bgp->peer_self->hostname = NULL;
- }
+ XFREE(MTYPE_BGP_PEER_HOST, bgp->peer_self->hostname);
if (cmd_hostname_get())
bgp->peer_self->hostname =
XSTRDUP(MTYPE_BGP_PEER_HOST, cmd_hostname_get());
- if (bgp->peer_self->domainname != NULL) {
- XFREE(MTYPE_BGP_PEER_HOST, bgp->peer_self->domainname);
- bgp->peer_self->domainname = NULL;
- }
+ XFREE(MTYPE_BGP_PEER_HOST, bgp->peer_self->domainname);
if (cmd_domainname_get())
bgp->peer_self->domainname =
XSTRDUP(MTYPE_BGP_PEER_HOST, cmd_domainname_get());
@@ -4506,8 +4442,6 @@ int peer_description_unset(struct peer *peer)
{
XFREE(MTYPE_PEER_DESC, peer->desc);
- peer->desc = NULL;
-
return 0;
}
@@ -5257,7 +5191,6 @@ void peer_interface_set(struct peer *peer, const char *str)
void peer_interface_unset(struct peer *peer)
{
XFREE(MTYPE_BGP_PEER_IFNAME, peer->ifname);
- peer->ifname = NULL;
}
/* Allow-as in. */
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 3f33139ef2..04355450d7 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -1382,8 +1382,7 @@ DECLARE_QOBJ_TYPE(peer)
((peer)->attr = (group)->conf->attr)
#define PEER_STR_ATTR_INHERIT(peer, group, attr, mt) \
do { \
- if ((peer)->attr) \
- XFREE(mt, (peer)->attr); \
+ XFREE(mt, (peer)->attr); \
if ((group)->conf->attr) \
(peer)->attr = XSTRDUP(mt, (group)->conf->attr); \
else \
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index 7c4f8eaa01..4701d2e1fa 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -1489,10 +1489,7 @@ void rfapiFreeBgpTeaOptionChain(struct bgp_tea_options *p)
while (p) {
next = p->next;
- if (p->value) {
- XFREE(MTYPE_BGP_TEA_OPTIONS_VALUE, p->value);
- p->value = NULL;
- }
+ XFREE(MTYPE_BGP_TEA_OPTIONS_VALUE, p->value);
XFREE(MTYPE_BGP_TEA_OPTIONS, p);
p = next;
diff --git a/bgpd/rfapi/rfapi_encap_tlv.c b/bgpd/rfapi/rfapi_encap_tlv.c
index f31342e192..a7bc909c58 100644
--- a/bgpd/rfapi/rfapi_encap_tlv.c
+++ b/bgpd/rfapi/rfapi_encap_tlv.c
@@ -248,7 +248,6 @@ struct rfapi_un_option *rfapi_encap_tlv_to_un_option(struct attr *attr)
}
if (rc) {
XFREE(MTYPE_RFAPI_UN_OPTION, uo);
- uo = NULL;
}
return uo;
}
diff --git a/eigrpd/eigrp_interface.c b/eigrpd/eigrp_interface.c
index ece0b4b0c4..9ef4e86237 100644
--- a/eigrpd/eigrp_interface.c
+++ b/eigrpd/eigrp_interface.c
@@ -121,7 +121,6 @@ int eigrp_if_delete_hook(struct interface *ifp)
eigrp_fifo_free(ei->obuf);
XFREE(MTYPE_EIGRP_IF_INFO, ifp->info);
- ifp->info = NULL;
return 0;
}
diff --git a/isisd/isis_bfd.c b/isisd/isis_bfd.c
index cf4b841798..68be9c1a99 100644
--- a/isisd/isis_bfd.c
+++ b/isisd/isis_bfd.c
@@ -59,7 +59,6 @@ static void bfd_session_free(struct bfd_session **session)
return;
XFREE(MTYPE_BFD_SESSION, *session);
- *session = NULL;
}
static bool bfd_session_same(const struct bfd_session *session, int family,
diff --git a/lib/bfd.c b/lib/bfd.c
index ffb3cbc1f8..4e192422cd 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -74,10 +74,7 @@ struct bfd_info *bfd_info_create(void)
*/
void bfd_info_free(struct bfd_info **bfd_info)
{
- if (*bfd_info) {
- XFREE(MTYPE_BFD_INFO, *bfd_info);
- *bfd_info = NULL;
- }
+ XFREE(MTYPE_BFD_INFO, *bfd_info);
}
/*
diff --git a/lib/command.c b/lib/command.c
index d2145d9f5a..8811b3a791 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -2503,8 +2503,6 @@ static void disable_log_file(void)
zlog_reset_file();
XFREE(MTYPE_HOST, host.logfile);
-
- host.logfile = NULL;
}
DEFUN (no_config_log_file,
@@ -2661,8 +2659,7 @@ int cmd_banner_motd_file(const char *file)
void cmd_banner_motd_line(const char *line)
{
- if (host.motd)
- XFREE(MTYPE_HOST, host.motd);
+ XFREE(MTYPE_HOST, host.motd);
host.motd = XSTRDUP(MTYPE_HOST, line);
}
diff --git a/lib/distribute.c b/lib/distribute.c
index 2aa6b927fb..3ea60c8772 100644
--- a/lib/distribute.c
+++ b/lib/distribute.c
@@ -186,7 +186,6 @@ static int distribute_list_unset(struct distribute_ctx *ctx,
return 0;
XFREE(MTYPE_DISTRIBUTE_NAME, dist->list[type]);
- dist->list[type] = NULL;
/* Apply this distribute-list to the interface. */
(ctx->distribute_delete_hook)(ctx, dist);
@@ -232,7 +231,6 @@ static int distribute_list_prefix_unset(struct distribute_ctx *ctx,
return 0;
XFREE(MTYPE_DISTRIBUTE_NAME, dist->prefix[type]);
- dist->prefix[type] = NULL;
/* Apply this distribute-list to the interface. */
(ctx->distribute_delete_hook)(ctx, dist);
diff --git a/lib/filter.c b/lib/filter.c
index 31e25d6001..4521cf6469 100644
--- a/lib/filter.c
+++ b/lib/filter.c
@@ -608,10 +608,7 @@ static int vty_access_list_remark_unset(struct vty *vty, afi_t afi,
return CMD_WARNING_CONFIG_FAILED;
}
- if (access->remark) {
- XFREE(MTYPE_TMP, access->remark);
- access->remark = NULL;
- }
+ XFREE(MTYPE_TMP, access->remark);
if (access->head == NULL && access->tail == NULL)
access_list_delete(access);
diff --git a/lib/if.c b/lib/if.c
index 7332dceb45..0e9471923f 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -1281,7 +1281,6 @@ void if_link_params_free(struct interface *ifp)
if (ifp->link_params == NULL)
return;
XFREE(MTYPE_IF_LINK_PARAMS, ifp->link_params);
- ifp->link_params = NULL;
}
/* ----------- CLI commands ----------- */
diff --git a/lib/if_rmap.c b/lib/if_rmap.c
index ca6f512ec6..1973d40be4 100644
--- a/lib/if_rmap.c
+++ b/lib/if_rmap.c
@@ -164,7 +164,6 @@ static int if_rmap_unset(struct if_rmap_ctx *ctx,
return 0;
XFREE(MTYPE_IF_RMAP_NAME, if_rmap->routemap[IF_RMAP_IN]);
- if_rmap->routemap[IF_RMAP_IN] = NULL;
}
if (type == IF_RMAP_OUT) {
@@ -174,7 +173,6 @@ static int if_rmap_unset(struct if_rmap_ctx *ctx,
return 0;
XFREE(MTYPE_IF_RMAP_NAME, if_rmap->routemap[IF_RMAP_OUT]);
- if_rmap->routemap[IF_RMAP_OUT] = NULL;
}
if (ctx->if_rmap_delete_hook)
diff --git a/lib/log.c b/lib/log.c
index d7034ce930..7bf16a8212 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -934,7 +934,6 @@ int zlog_reset_file(void)
zl->maxlvl[ZLOG_DEST_FILE] = ZLOG_DISABLED;
XFREE(MTYPE_ZLOG, zl->filename);
- zl->filename = NULL;
return 1;
}
diff --git a/lib/plist.c b/lib/plist.c
index a0976cd6bd..f6ceba81e8 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -496,7 +496,6 @@ static void prefix_list_trie_del(struct prefix_list *plist,
for (; depth > 0; depth--)
if (trie_table_empty(*tables[depth])) {
XFREE(MTYPE_PREFIX_LIST_TRIE, *tables[depth]);
- *tables[depth] = NULL;
}
}
@@ -1093,10 +1092,7 @@ static int vty_prefix_list_desc_unset(struct vty *vty, afi_t afi,
return CMD_WARNING_CONFIG_FAILED;
}
- if (plist->desc) {
- XFREE(MTYPE_TMP, plist->desc);
- plist->desc = NULL;
- }
+ XFREE(MTYPE_TMP, plist->desc);
if (plist->head == NULL && plist->tail == NULL && plist->desc == NULL)
prefix_list_delete(plist);
diff --git a/lib/prefix.c b/lib/prefix.c
index 806df0b4c6..cb6e53b305 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -1081,7 +1081,6 @@ void prefix_free_lists(void *arg)
void prefix_free(struct prefix **p)
{
XFREE(MTYPE_PREFIX, *p);
- *p = NULL;
}
/* Utility function to convert ipv4 prefixes to Classful prefixes */
diff --git a/lib/routemap.c b/lib/routemap.c
index 14fec0283c..9771288a65 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -2063,7 +2063,6 @@ static int route_map_dep_update(struct hash *dephash, const char *dep_name,
hash_free(dep->dep_rmap_hash);
XFREE(MTYPE_ROUTE_MAP_NAME, dep->dep_name);
XFREE(MTYPE_ROUTE_MAP_DEP, dep);
- dep = NULL;
}
break;
case RMAP_EVENT_SET_ADDED:
diff --git a/lib/vty.c b/lib/vty.c
index 40da8abcd7..cf16133852 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -3011,15 +3011,8 @@ void vty_reset(void)
vty_timeout_val = VTY_TIMEOUT_DEFAULT;
- if (vty_accesslist_name) {
- XFREE(MTYPE_VTY, vty_accesslist_name);
- vty_accesslist_name = NULL;
- }
-
- if (vty_ipv6_accesslist_name) {
- XFREE(MTYPE_VTY, vty_ipv6_accesslist_name);
- vty_ipv6_accesslist_name = NULL;
- }
+ XFREE(MTYPE_VTY, vty_accesslist_name);
+ XFREE(MTYPE_VTY, vty_ipv6_accesslist_name);
}
static void vty_save_cwd(void)
diff --git a/nhrpd/nhrp_route.c b/nhrpd/nhrp_route.c
index cfca86a9bf..a23ac34745 100644
--- a/nhrpd/nhrp_route.c
+++ b/nhrpd/nhrp_route.c
@@ -58,7 +58,6 @@ static void nhrp_route_update_put(struct route_node *rn)
if (!ri->ifp && !ri->nhrp_ifp
&& sockunion_family(&ri->via) == AF_UNSPEC) {
XFREE(MTYPE_NHRP_ROUTE, rn->info);
- rn->info = NULL;
route_unlock_node(rn);
}
route_unlock_node(rn);
diff --git a/nhrpd/nhrp_shortcut.c b/nhrpd/nhrp_shortcut.c
index 84053b4b5d..b3fdecf0ec 100644
--- a/nhrpd/nhrp_shortcut.c
+++ b/nhrpd/nhrp_shortcut.c
@@ -141,7 +141,6 @@ static void nhrp_shortcut_delete(struct nhrp_shortcut *s)
rn = route_node_lookup(shortcut_rib[afi], s->p);
if (rn) {
XFREE(MTYPE_NHRP_SHORTCUT, rn->info);
- rn->info = NULL;
route_unlock_node(rn);
route_unlock_node(rn);
}
diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c
index da42a24252..d75fc39bbb 100644
--- a/ospf6d/ospf6_message.c
+++ b/ospf6d/ospf6_message.c
@@ -1516,15 +1516,8 @@ int ospf6_iobuf_size(unsigned int size)
void ospf6_message_terminate(void)
{
- if (recvbuf) {
- XFREE(MTYPE_OSPF6_MESSAGE, recvbuf);
- recvbuf = NULL;
- }
-
- if (sendbuf) {
- XFREE(MTYPE_OSPF6_MESSAGE, sendbuf);
- sendbuf = NULL;
- }
+ XFREE(MTYPE_OSPF6_MESSAGE, recvbuf);
+ XFREE(MTYPE_OSPF6_MESSAGE, sendbuf);
iobuflen = 0;
}
diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c
index a60af36564..6d00935347 100644
--- a/ospfd/ospf_asbr.c
+++ b/ospfd/ospf_asbr.c
@@ -141,7 +141,6 @@ ospf_external_info_add(struct ospf *ospf, uint8_t type, unsigned short instance,
ospf->vrf_id, inet_ntoa(p.prefix),
p.prefixlen, inetbuf);
XFREE(MTYPE_OSPF_EXTERNAL_INFO, rn->info);
- rn->info = NULL;
}
/* Create new External info instance. */
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index 8efb32af37..3eb03f53c4 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -694,7 +694,6 @@ static int ospf_if_delete_hook(struct interface *ifp)
ospf_del_if_params((struct ospf_if_params *)IF_DEF_PARAMS(ifp));
XFREE(MTYPE_OSPF_IF_INFO, ifp->info);
- ifp->info = NULL;
return rc;
}
diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c
index 4a69e4d1ab..e14b7e058d 100644
--- a/pimd/pim_bsm.c
+++ b/pimd/pim_bsm.c
@@ -86,8 +86,7 @@ static void pim_free_bsgrp_node(struct route_table *rt, struct prefix *grp)
static void pim_bsm_node_free(struct bsm_info *bsm)
{
- if (bsm->bsm)
- XFREE(MTYPE_PIM_BSM_PKT_VAR_MEM, bsm->bsm);
+ XFREE(MTYPE_PIM_BSM_PKT_VAR_MEM, bsm->bsm);
XFREE(MTYPE_PIM_BSM_INFO, bsm);
}
diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c
index 58ebc6ce67..bb02a36e1d 100644
--- a/pimd/pim_msdp.c
+++ b/pimd/pim_msdp.c
@@ -1175,9 +1175,7 @@ static void pim_msdp_peer_free(struct pim_msdp_peer *mp)
stream_fifo_free(mp->obuf);
}
- if (mp->mesh_group_name) {
- XFREE(MTYPE_PIM_MSDP_MG_NAME, mp->mesh_group_name);
- }
+ XFREE(MTYPE_PIM_MSDP_MG_NAME, mp->mesh_group_name);
mp->pim = NULL;
XFREE(MTYPE_PIM_MSDP_PEER, mp);
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index 4d48740606..d07cc894a5 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -1210,7 +1210,6 @@ static int rip_interface_delete_hook(struct interface *ifp)
{
rip_interface_reset(ifp->info);
XFREE(MTYPE_RIP_INTERFACE, ifp->info);
- ifp->info = NULL;
return 0;
}
diff --git a/ripd/ripd.c b/ripd/ripd.c
index ec0770ef3d..99f48dffdd 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -3670,8 +3670,7 @@ static int rip_vrf_enable(struct vrf *vrf)
running_config->version++;
}
}
- if (old_vrf_name)
- XFREE(MTYPE_RIP_VRF_NAME, old_vrf_name);
+ XFREE(MTYPE_RIP_VRF_NAME, old_vrf_name);
}
if (!rip || rip->enabled)
return 0;
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c
index 97113a180f..250c7803f7 100644
--- a/ripngd/ripng_interface.c
+++ b/ripngd/ripng_interface.c
@@ -913,7 +913,6 @@ static int ripng_if_new_hook(struct interface *ifp)
static int ripng_if_delete_hook(struct interface *ifp)
{
XFREE(MTYPE_RIPNG_IF, ifp->info);
- ifp->info = NULL;
return 0;
}
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index ad2ddd0dba..f8d7dc968b 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -2804,8 +2804,7 @@ static int ripng_vrf_enable(struct vrf *vrf)
running_config->version++;
}
}
- if (old_vrf_name)
- XFREE(MTYPE_RIPNG_VRF_NAME, old_vrf_name);
+ XFREE(MTYPE_RIPNG_VRF_NAME, old_vrf_name);
}
if (ripng->enabled)
diff --git a/tests/lib/test_heavy_wq.c b/tests/lib/test_heavy_wq.c
index 442b8c8380..cffd52ee02 100644
--- a/tests/lib/test_heavy_wq.c
+++ b/tests/lib/test_heavy_wq.c
@@ -81,7 +81,6 @@ static void slow_func_del(struct work_queue *wq, void *data)
assert(hn && hn->str);
printf("%s: %s\n", __func__, hn->str);
XFREE(MTYPE_WQ_NODE_STR, hn->str);
- hn->str = NULL;
XFREE(MTYPE_WQ_NODE, hn);
}
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index 238b1d905b..3a46835d1a 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -1153,7 +1153,6 @@ static char *command_generator(const char *text, int state)
return matched[index++];
XFREE(MTYPE_TMP, matched);
- matched = NULL;
return NULL;
}
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c
index bf1ba522a3..17b148178f 100644
--- a/zebra/zebra_dplane.c
+++ b/zebra/zebra_dplane.c
@@ -549,7 +549,6 @@ static void dplane_ctx_free(struct zebra_dplane_ctx **pctx)
}
XFREE(MTYPE_DP_CTX, *pctx);
- *pctx = NULL;
}
/*
diff --git a/zebra/zebra_mlag.c b/zebra/zebra_mlag.c
index f6bd5f4586..fc7804a409 100644
--- a/zebra/zebra_mlag.c
+++ b/zebra/zebra_mlag.c
@@ -797,13 +797,11 @@ int zebra_mlag_protobuf_encode_client_data(struct stream *s, uint32_t *msg_type)
}
for (i = 0; i < mlag_msg.msg_cnt; i++) {
- if (pay_load[i]->vrf_name)
- XFREE(MTYPE_MLAG_PBUF, pay_load[i]->vrf_name);
+ XFREE(MTYPE_MLAG_PBUF, pay_load[i]->vrf_name);
if (pay_load[i]->owner_id == MLAG_OWNER_INTERFACE
&& pay_load[i]->intf_name)
XFREE(MTYPE_MLAG_PBUF, pay_load[i]->intf_name);
- if (pay_load[i])
- XFREE(MTYPE_MLAG_PBUF, pay_load[i]);
+ XFREE(MTYPE_MLAG_PBUF, pay_load[i]);
}
XFREE(MTYPE_MLAG_PBUF, pay_load);
if (cleanup == true)
@@ -861,13 +859,11 @@ int zebra_mlag_protobuf_encode_client_data(struct stream *s, uint32_t *msg_type)
}
for (i = 0; i < mlag_msg.msg_cnt; i++) {
- if (pay_load[i]->vrf_name)
- XFREE(MTYPE_MLAG_PBUF, pay_load[i]->vrf_name);
+ XFREE(MTYPE_MLAG_PBUF, pay_load[i]->vrf_name);
if (pay_load[i]->owner_id == MLAG_OWNER_INTERFACE
&& pay_load[i]->intf_name)
XFREE(MTYPE_MLAG_PBUF, pay_load[i]->intf_name);
- if (pay_load[i])
- XFREE(MTYPE_MLAG_PBUF, pay_load[i]);
+ XFREE(MTYPE_MLAG_PBUF, pay_load[i]);
}
XFREE(MTYPE_MLAG_PBUF, pay_load);
if (cleanup)
@@ -914,8 +910,7 @@ int zebra_mlag_protobuf_encode_client_data(struct stream *s, uint32_t *msg_type)
mlag_lib_msgid_to_str(mlag_msg.msg_type, buf,
sizeof(buf)),
len);
- if (hdr.data.data)
- XFREE(MTYPE_MLAG_PBUF, hdr.data.data);
+ XFREE(MTYPE_MLAG_PBUF, hdr.data.data);
return len;
}
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c
index ac58352a16..bb95e72382 100644
--- a/zebra/zebra_nhg.c
+++ b/zebra/zebra_nhg.c
@@ -714,7 +714,6 @@ static void nhg_ctx_free(struct nhg_ctx **ctx)
done:
XFREE(MTYPE_NHG_CTX, *ctx);
- *ctx = NULL;
}
static struct nhg_ctx *nhg_ctx_init(uint32_t id, struct nexthop *nh,
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 051d7f5231..6276a5d8b3 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -3114,8 +3114,6 @@ static struct rib_update_ctx *rib_update_ctx_init(vrf_id_t vrf_id,
static void rib_update_ctx_fini(struct rib_update_ctx **ctx)
{
XFREE(MTYPE_RIB_UPDATE_CTX, *ctx);
-
- *ctx = NULL;
}
static int rib_update_handler(struct thread *thread)