*: don't null after XFREE; XFREE does this itself

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
Quentin Young 2020-02-03 11:22:13 -05:00
parent 84e1268340
commit b3ba5dc7fe
43 changed files with 0 additions and 82 deletions

View File

@ -165,7 +165,6 @@ babel_create_routing_process (void)
return 0; return 0;
fail: fail:
XFREE(MTYPE_BABEL, babel_routing_process); XFREE(MTYPE_BABEL, babel_routing_process);
babel_routing_process = NULL;
return -1; return -1;
} }
@ -324,7 +323,6 @@ babel_clean_routing_process(void)
distribute_list_delete(&babel_routing_process->distribute_ctx); distribute_list_delete(&babel_routing_process->distribute_ctx);
XFREE(MTYPE_BABEL, babel_routing_process); XFREE(MTYPE_BABEL, babel_routing_process);
babel_routing_process = NULL;
} }
/* Function used with timeout. */ /* Function used with timeout. */

View File

@ -407,7 +407,6 @@ static void control_reset_buf(struct bfd_control_buffer *bcb)
{ {
/* Get ride of old data. */ /* Get ride of old data. */
XFREE(MTYPE_BFDD_NOTIFICATION, bcb->bcb_buf); XFREE(MTYPE_BFDD_NOTIFICATION, bcb->bcb_buf);
bcb->bcb_buf = NULL;
bcb->bcb_pos = 0; bcb->bcb_pos = 0;
bcb->bcb_left = 0; bcb->bcb_left = 0;
} }

View File

@ -256,6 +256,5 @@ void bgp_sync_delete(struct peer *peer)
FOREACH_AFI_SAFI (afi, safi) { FOREACH_AFI_SAFI (afi, safi) {
XFREE(MTYPE_BGP_SYNCHRONISE, peer->sync[afi][safi]); XFREE(MTYPE_BGP_SYNCHRONISE, peer->sync[afi][safi]);
peer->sync[afi][safi] = NULL;
} }
} }

View File

@ -89,7 +89,6 @@ void community_del_val(struct community *com, uint32_t *val)
com->val, com_length(com)); com->val, com_length(com));
else { else {
XFREE(MTYPE_COMMUNITY_VAL, com->val); XFREE(MTYPE_COMMUNITY_VAL, com->val);
com->val = NULL;
} }
return; return;
} }

View File

@ -669,7 +669,6 @@ static int bgp_dump_unset(struct bgp_dump *bgp_dump)
/* Removing file name. */ /* Removing file name. */
if (bgp_dump->filename) { if (bgp_dump->filename) {
XFREE(MTYPE_BGP_DUMP_STR, bgp_dump->filename); XFREE(MTYPE_BGP_DUMP_STR, bgp_dump->filename);
bgp_dump->filename = NULL;
} }
/* Closing file. */ /* Closing file. */
@ -689,7 +688,6 @@ static int bgp_dump_unset(struct bgp_dump *bgp_dump)
/* Removing interval string. */ /* Removing interval string. */
if (bgp_dump->interval_str) { if (bgp_dump->interval_str) {
XFREE(MTYPE_BGP_DUMP_STR, bgp_dump->interval_str); XFREE(MTYPE_BGP_DUMP_STR, bgp_dump->interval_str);
bgp_dump->interval_str = NULL;
} }
return CMD_SUCCESS; return CMD_SUCCESS;

View File

@ -170,7 +170,6 @@ static void as_list_free(struct as_list *aslist)
{ {
if (aslist->name) { if (aslist->name) {
XFREE(MTYPE_AS_STR, aslist->name); XFREE(MTYPE_AS_STR, aslist->name);
aslist->name = NULL;
} }
XFREE(MTYPE_AS_LIST, aslist); XFREE(MTYPE_AS_LIST, aslist);
} }

View File

@ -527,7 +527,6 @@ void lcommunity_del_val(struct lcommunity *lcom, uint8_t *ptr)
lcom->val, lcom_length(lcom)); lcom->val, lcom_length(lcom));
else { else {
XFREE(MTYPE_LCOMMUNITY_VAL, lcom->val); XFREE(MTYPE_LCOMMUNITY_VAL, lcom->val);
lcom->val = NULL;
} }
return; return;
} }

View File

@ -272,7 +272,6 @@ static int bgp_vrf_enable(struct vrf *vrf)
if (bgp && bgp->vrf_id != vrf->vrf_id) { if (bgp && bgp->vrf_id != vrf->vrf_id) {
if (bgp->name && strmatch(vrf->name, VRF_DEFAULT_NAME)) { if (bgp->name && strmatch(vrf->name, VRF_DEFAULT_NAME)) {
XFREE(MTYPE_BGP, bgp->name); XFREE(MTYPE_BGP, bgp->name);
bgp->name = NULL;
XFREE(MTYPE_BGP, bgp->name_pretty); XFREE(MTYPE_BGP, bgp->name_pretty);
bgp->name_pretty = XSTRDUP(MTYPE_BGP, "VRF default"); bgp->name_pretty = XSTRDUP(MTYPE_BGP, "VRF default");
bgp->inst_type = BGP_INSTANCE_TYPE_DEFAULT; bgp->inst_type = BGP_INSTANCE_TYPE_DEFAULT;

View File

@ -280,7 +280,6 @@ void bgp_path_info_mpath_free(struct bgp_path_info_mpath **mpath)
if ((*mpath)->mp_attr) if ((*mpath)->mp_attr)
bgp_attr_unintern(&(*mpath)->mp_attr); bgp_attr_unintern(&(*mpath)->mp_attr);
XFREE(MTYPE_BGP_MPATH_INFO, *mpath); XFREE(MTYPE_BGP_MPATH_INFO, *mpath);
*mpath = NULL;
} }
} }

View File

@ -712,12 +712,10 @@ static int bgp_capability_hostname(struct peer *peer,
if (peer->hostname != NULL) { if (peer->hostname != NULL) {
XFREE(MTYPE_BGP_PEER_HOST, peer->hostname); XFREE(MTYPE_BGP_PEER_HOST, peer->hostname);
peer->hostname = NULL;
} }
if (peer->domainname != NULL) { if (peer->domainname != NULL) {
XFREE(MTYPE_BGP_PEER_HOST, peer->domainname); XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
peer->domainname = NULL;
} }
peer->hostname = XSTRDUP(MTYPE_BGP_PEER_HOST, str); peer->hostname = XSTRDUP(MTYPE_BGP_PEER_HOST, str);
@ -752,7 +750,6 @@ static int bgp_capability_hostname(struct peer *peer,
if (peer->domainname != NULL) { if (peer->domainname != NULL) {
XFREE(MTYPE_BGP_PEER_HOST, peer->domainname); XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
peer->domainname = NULL;
} }
peer->domainname = XSTRDUP(MTYPE_BGP_PEER_HOST, str); peer->domainname = XSTRDUP(MTYPE_BGP_PEER_HOST, str);

View File

@ -752,7 +752,6 @@ void bgp_notify_send_with_data(struct peer *peer, uint8_t code,
if (bgp_notify.data) { if (bgp_notify.data) {
XFREE(MTYPE_TMP, bgp_notify.data); XFREE(MTYPE_TMP, bgp_notify.data);
bgp_notify.data = NULL;
bgp_notify.length = 0; bgp_notify.length = 0;
} }
} }
@ -1745,7 +1744,6 @@ static int bgp_notify_receive(struct peer *peer, bgp_size_t size)
if (peer->notify.data) { if (peer->notify.data) {
XFREE(MTYPE_TMP, peer->notify.data); XFREE(MTYPE_TMP, peer->notify.data);
peer->notify.data = NULL;
peer->notify.length = 0; 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"); bgp_notify_print(peer, &bgp_notify, "received");
if (bgp_notify.data) { if (bgp_notify.data) {
XFREE(MTYPE_TMP, bgp_notify.data); XFREE(MTYPE_TMP, bgp_notify.data);
bgp_notify.data = NULL;
bgp_notify.length = 0; bgp_notify.length = 0;
} }
} }

View File

@ -1260,7 +1260,6 @@ void bgp_pbr_cleanup(struct bgp *bgp)
return; return;
bgp_pbr_reset(bgp, AFI_IP); bgp_pbr_reset(bgp, AFI_IP);
XFREE(MTYPE_PBR, bgp->bgp_pbr_cfg); XFREE(MTYPE_PBR, bgp->bgp_pbr_cfg);
bgp->bgp_pbr_cfg = NULL;
} }
void bgp_pbr_init(struct bgp *bgp) void bgp_pbr_init(struct bgp *bgp)

View File

@ -234,8 +234,6 @@ void bgp_path_info_extra_free(struct bgp_path_info_extra **extra)
if ((*extra)->bgp_fs_pbr) if ((*extra)->bgp_fs_pbr)
list_delete(&((*extra)->bgp_fs_pbr)); list_delete(&((*extra)->bgp_fs_pbr));
XFREE(MTYPE_BGP_ROUTE_EXTRA, *extra); XFREE(MTYPE_BGP_ROUTE_EXTRA, *extra);
*extra = NULL;
} }
/* Get bgp_path_info extra information for the given bgp_path_info, lazy /* Get bgp_path_info extra information for the given bgp_path_info, lazy
@ -5453,7 +5451,6 @@ static int bgp_static_set(struct vty *vty, const char *negate,
bgp_static->rmap.name); bgp_static->rmap.name);
route_map_counter_decrement( route_map_counter_decrement(
bgp_static->rmap.map); bgp_static->rmap.map);
bgp_static->rmap.name = NULL;
bgp_static->rmap.map = NULL; bgp_static->rmap.map = NULL;
bgp_static->valid = 0; bgp_static->valid = 0;
} }
@ -5875,7 +5872,6 @@ static int bgp_table_map_set(struct vty *vty, afi_t afi, safi_t safi,
} else { } else {
XFREE(MTYPE_ROUTE_MAP_NAME, rmap->name); XFREE(MTYPE_ROUTE_MAP_NAME, rmap->name);
route_map_counter_decrement(rmap->map); route_map_counter_decrement(rmap->map);
rmap->name = NULL;
rmap->map = NULL; rmap->map = NULL;
} }
@ -5894,7 +5890,6 @@ static int bgp_table_map_unset(struct vty *vty, afi_t afi, safi_t safi,
rmap = &bgp->table_map[afi][safi]; rmap = &bgp->table_map[afi][safi];
XFREE(MTYPE_ROUTE_MAP_NAME, rmap->name); XFREE(MTYPE_ROUTE_MAP_NAME, rmap->name);
route_map_counter_decrement(rmap->map); route_map_counter_decrement(rmap->map);
rmap->name = NULL;
rmap->map = NULL; rmap->map = NULL;
if (bgp_fibupd_safi(safi)) if (bgp_fibupd_safi(safi))
@ -12167,7 +12162,6 @@ static int bgp_distance_set(struct vty *vty, const char *distance_str,
/* Reset access-list configuration. */ /* Reset access-list configuration. */
if (bdistance->access_list) { if (bdistance->access_list) {
XFREE(MTYPE_AS_LIST, bdistance->access_list); XFREE(MTYPE_AS_LIST, bdistance->access_list);
bdistance->access_list = NULL;
} }
if (access_list_str) if (access_list_str)
bdistance->access_list = bdistance->access_list =

View File

@ -111,7 +111,6 @@ static void sync_init(struct update_subgroup *subgrp)
static void sync_delete(struct update_subgroup *subgrp) static void sync_delete(struct update_subgroup *subgrp)
{ {
XFREE(MTYPE_BGP_SYNCHRONISE, subgrp->sync); XFREE(MTYPE_BGP_SYNCHRONISE, subgrp->sync);
subgrp->sync = NULL;
if (subgrp->hash) if (subgrp->hash)
hash_free(subgrp->hash); hash_free(subgrp->hash);
subgrp->hash = NULL; 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_FILTER_NAME, srcfilter->usmap.name);
XFREE(MTYPE_BGP_PEER_HOST, src->host); XFREE(MTYPE_BGP_PEER_HOST, src->host);
src->host = NULL;
} }
static void peer2_updgrp_copy(struct update_group *updgrp, struct peer_af *paf) 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); conf_release(updgrp->conf, updgrp->afi, updgrp->safi);
XFREE(MTYPE_BGP_PEER_HOST, updgrp->conf->host); XFREE(MTYPE_BGP_PEER_HOST, updgrp->conf->host);
updgrp->conf->host = NULL;
XFREE(MTYPE_BGP_PEER_IFNAME, updgrp->conf->ifname); XFREE(MTYPE_BGP_PEER_IFNAME, updgrp->conf->ifname);

View File

@ -1779,7 +1779,6 @@ int bgp_redistribute_unset(struct bgp *bgp, afi_t afi, int type,
/* Unset route-map. */ /* Unset route-map. */
XFREE(MTYPE_ROUTE_MAP_NAME, red->rmap.name); XFREE(MTYPE_ROUTE_MAP_NAME, red->rmap.name);
route_map_counter_decrement(red->rmap.map); route_map_counter_decrement(red->rmap.map);
red->rmap.name = NULL;
red->rmap.map = NULL; red->rmap.map = NULL;
/* Unset metric. */ /* Unset metric. */

View File

@ -1009,23 +1009,19 @@ static void peer_free(struct peer *peer)
if (peer->desc) { if (peer->desc) {
XFREE(MTYPE_PEER_DESC, peer->desc); XFREE(MTYPE_PEER_DESC, peer->desc);
peer->desc = NULL;
} }
/* Free allocated host character. */ /* Free allocated host character. */
if (peer->host) { if (peer->host) {
XFREE(MTYPE_BGP_PEER_HOST, peer->host); XFREE(MTYPE_BGP_PEER_HOST, peer->host);
peer->host = NULL;
} }
if (peer->domainname) { if (peer->domainname) {
XFREE(MTYPE_BGP_PEER_HOST, peer->domainname); XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
peer->domainname = NULL;
} }
if (peer->ifname) { if (peer->ifname) {
XFREE(MTYPE_BGP_PEER_IFNAME, peer->ifname); XFREE(MTYPE_BGP_PEER_IFNAME, peer->ifname);
peer->ifname = NULL;
} }
/* Update source configuration. */ /* Update source configuration. */
@ -1036,7 +1032,6 @@ static void peer_free(struct peer *peer)
if (peer->update_if) { if (peer->update_if) {
XFREE(MTYPE_PEER_UPDATE_SOURCE, peer->update_if); XFREE(MTYPE_PEER_UPDATE_SOURCE, peer->update_if);
peer->update_if = NULL;
} }
XFREE(MTYPE_TMP, peer->notify.data); XFREE(MTYPE_TMP, peer->notify.data);
@ -1049,7 +1044,6 @@ static void peer_free(struct peer *peer)
if (peer->conf_if) { if (peer->conf_if) {
XFREE(MTYPE_PEER_CONF_IF, peer->conf_if); XFREE(MTYPE_PEER_CONF_IF, peer->conf_if);
peer->conf_if = NULL;
} }
bfd_info_free(&(peer->bfd_info)); bfd_info_free(&(peer->bfd_info));
@ -1372,7 +1366,6 @@ void peer_xfer_config(struct peer *peer_dst, struct peer *peer_src)
sockunion_free(peer_dst->update_source); sockunion_free(peer_dst->update_source);
if (peer_dst->update_if) { if (peer_dst->update_if) {
XFREE(MTYPE_PEER_UPDATE_SOURCE, peer_dst->update_if); XFREE(MTYPE_PEER_UPDATE_SOURCE, peer_dst->update_if);
peer_dst->update_if = NULL;
} }
peer_dst->update_source = peer_dst->update_source =
sockunion_dup(peer_src->update_source); sockunion_dup(peer_src->update_source);
@ -2388,19 +2381,16 @@ int peer_delete(struct peer *peer)
if (filter->dlist[i].name) { if (filter->dlist[i].name) {
XFREE(MTYPE_BGP_FILTER_NAME, XFREE(MTYPE_BGP_FILTER_NAME,
filter->dlist[i].name); filter->dlist[i].name);
filter->dlist[i].name = NULL;
} }
if (filter->plist[i].name) { if (filter->plist[i].name) {
XFREE(MTYPE_BGP_FILTER_NAME, XFREE(MTYPE_BGP_FILTER_NAME,
filter->plist[i].name); filter->plist[i].name);
filter->plist[i].name = NULL;
} }
if (filter->aslist[i].name) { if (filter->aslist[i].name) {
XFREE(MTYPE_BGP_FILTER_NAME, XFREE(MTYPE_BGP_FILTER_NAME,
filter->aslist[i].name); filter->aslist[i].name);
filter->aslist[i].name = NULL;
} }
} }
@ -2408,19 +2398,16 @@ int peer_delete(struct peer *peer)
if (filter->map[i].name) { if (filter->map[i].name) {
XFREE(MTYPE_BGP_FILTER_NAME, XFREE(MTYPE_BGP_FILTER_NAME,
filter->map[i].name); filter->map[i].name);
filter->map[i].name = NULL;
} }
} }
if (filter->usmap.name) { if (filter->usmap.name) {
XFREE(MTYPE_BGP_FILTER_NAME, filter->usmap.name); XFREE(MTYPE_BGP_FILTER_NAME, filter->usmap.name);
filter->usmap.name = NULL;
} }
if (peer->default_rmap[afi][safi].name) { if (peer->default_rmap[afi][safi].name) {
XFREE(MTYPE_ROUTE_MAP_NAME, XFREE(MTYPE_ROUTE_MAP_NAME,
peer->default_rmap[afi][safi].name); peer->default_rmap[afi][safi].name);
peer->default_rmap[afi][safi].name = NULL;
} }
} }
@ -2429,12 +2416,10 @@ int peer_delete(struct peer *peer)
if (peer->hostname) { if (peer->hostname) {
XFREE(MTYPE_BGP_PEER_HOST, peer->hostname); XFREE(MTYPE_BGP_PEER_HOST, peer->hostname);
peer->hostname = NULL;
} }
if (peer->domainname) { if (peer->domainname) {
XFREE(MTYPE_BGP_PEER_HOST, peer->domainname); XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
peer->domainname = NULL;
} }
peer_unlock(peer); /* initial reference */ peer_unlock(peer); /* initial reference */
@ -2994,7 +2979,6 @@ static struct bgp *bgp_create(as_t *as, const char *name,
XSTRDUP(MTYPE_BGP_PEER_HOST, "Static announcement"); XSTRDUP(MTYPE_BGP_PEER_HOST, "Static announcement");
if (bgp->peer_self->hostname != NULL) { if (bgp->peer_self->hostname != NULL) {
XFREE(MTYPE_BGP_PEER_HOST, bgp->peer_self->hostname); XFREE(MTYPE_BGP_PEER_HOST, bgp->peer_self->hostname);
bgp->peer_self->hostname = NULL;
} }
if (cmd_hostname_get()) if (cmd_hostname_get())
bgp->peer_self->hostname = bgp->peer_self->hostname =
@ -3002,7 +2986,6 @@ static struct bgp *bgp_create(as_t *as, const char *name,
if (bgp->peer_self->domainname != NULL) { if (bgp->peer_self->domainname != NULL) {
XFREE(MTYPE_BGP_PEER_HOST, bgp->peer_self->domainname); XFREE(MTYPE_BGP_PEER_HOST, bgp->peer_self->domainname);
bgp->peer_self->domainname = NULL;
} }
if (cmd_domainname_get()) if (cmd_domainname_get())
bgp->peer_self->domainname = bgp->peer_self->domainname =
@ -4507,8 +4490,6 @@ int peer_description_unset(struct peer *peer)
{ {
XFREE(MTYPE_PEER_DESC, peer->desc); XFREE(MTYPE_PEER_DESC, peer->desc);
peer->desc = NULL;
return 0; return 0;
} }
@ -5258,7 +5239,6 @@ void peer_interface_set(struct peer *peer, const char *str)
void peer_interface_unset(struct peer *peer) void peer_interface_unset(struct peer *peer)
{ {
XFREE(MTYPE_BGP_PEER_IFNAME, peer->ifname); XFREE(MTYPE_BGP_PEER_IFNAME, peer->ifname);
peer->ifname = NULL;
} }
/* Allow-as in. */ /* Allow-as in. */

View File

@ -1491,7 +1491,6 @@ void rfapiFreeBgpTeaOptionChain(struct bgp_tea_options *p)
if (p->value) { if (p->value) {
XFREE(MTYPE_BGP_TEA_OPTIONS_VALUE, p->value); XFREE(MTYPE_BGP_TEA_OPTIONS_VALUE, p->value);
p->value = NULL;
} }
XFREE(MTYPE_BGP_TEA_OPTIONS, p); XFREE(MTYPE_BGP_TEA_OPTIONS, p);

View File

@ -248,7 +248,6 @@ struct rfapi_un_option *rfapi_encap_tlv_to_un_option(struct attr *attr)
} }
if (rc) { if (rc) {
XFREE(MTYPE_RFAPI_UN_OPTION, uo); XFREE(MTYPE_RFAPI_UN_OPTION, uo);
uo = NULL;
} }
return uo; return uo;
} }

View File

@ -121,7 +121,6 @@ int eigrp_if_delete_hook(struct interface *ifp)
eigrp_fifo_free(ei->obuf); eigrp_fifo_free(ei->obuf);
XFREE(MTYPE_EIGRP_IF_INFO, ifp->info); XFREE(MTYPE_EIGRP_IF_INFO, ifp->info);
ifp->info = NULL;
return 0; return 0;
} }

View File

@ -59,7 +59,6 @@ static void bfd_session_free(struct bfd_session **session)
return; return;
XFREE(MTYPE_BFD_SESSION, *session); XFREE(MTYPE_BFD_SESSION, *session);
*session = NULL;
} }
static bool bfd_session_same(const struct bfd_session *session, int family, static bool bfd_session_same(const struct bfd_session *session, int family,

View File

@ -76,7 +76,6 @@ void bfd_info_free(struct bfd_info **bfd_info)
{ {
if (*bfd_info) { if (*bfd_info) {
XFREE(MTYPE_BFD_INFO, *bfd_info); XFREE(MTYPE_BFD_INFO, *bfd_info);
*bfd_info = NULL;
} }
} }

View File

@ -2503,8 +2503,6 @@ static void disable_log_file(void)
zlog_reset_file(); zlog_reset_file();
XFREE(MTYPE_HOST, host.logfile); XFREE(MTYPE_HOST, host.logfile);
host.logfile = NULL;
} }
DEFUN (no_config_log_file, DEFUN (no_config_log_file,

View File

@ -186,7 +186,6 @@ static int distribute_list_unset(struct distribute_ctx *ctx,
return 0; return 0;
XFREE(MTYPE_DISTRIBUTE_NAME, dist->list[type]); XFREE(MTYPE_DISTRIBUTE_NAME, dist->list[type]);
dist->list[type] = NULL;
/* Apply this distribute-list to the interface. */ /* Apply this distribute-list to the interface. */
(ctx->distribute_delete_hook)(ctx, dist); (ctx->distribute_delete_hook)(ctx, dist);
@ -232,7 +231,6 @@ static int distribute_list_prefix_unset(struct distribute_ctx *ctx,
return 0; return 0;
XFREE(MTYPE_DISTRIBUTE_NAME, dist->prefix[type]); XFREE(MTYPE_DISTRIBUTE_NAME, dist->prefix[type]);
dist->prefix[type] = NULL;
/* Apply this distribute-list to the interface. */ /* Apply this distribute-list to the interface. */
(ctx->distribute_delete_hook)(ctx, dist); (ctx->distribute_delete_hook)(ctx, dist);

View File

@ -610,7 +610,6 @@ static int vty_access_list_remark_unset(struct vty *vty, afi_t afi,
if (access->remark) { if (access->remark) {
XFREE(MTYPE_TMP, access->remark); XFREE(MTYPE_TMP, access->remark);
access->remark = NULL;
} }
if (access->head == NULL && access->tail == NULL) if (access->head == NULL && access->tail == NULL)

View File

@ -1281,7 +1281,6 @@ void if_link_params_free(struct interface *ifp)
if (ifp->link_params == NULL) if (ifp->link_params == NULL)
return; return;
XFREE(MTYPE_IF_LINK_PARAMS, ifp->link_params); XFREE(MTYPE_IF_LINK_PARAMS, ifp->link_params);
ifp->link_params = NULL;
} }
/* ----------- CLI commands ----------- */ /* ----------- CLI commands ----------- */

View File

@ -164,7 +164,6 @@ static int if_rmap_unset(struct if_rmap_ctx *ctx,
return 0; return 0;
XFREE(MTYPE_IF_RMAP_NAME, if_rmap->routemap[IF_RMAP_IN]); XFREE(MTYPE_IF_RMAP_NAME, if_rmap->routemap[IF_RMAP_IN]);
if_rmap->routemap[IF_RMAP_IN] = NULL;
} }
if (type == IF_RMAP_OUT) { if (type == IF_RMAP_OUT) {
@ -174,7 +173,6 @@ static int if_rmap_unset(struct if_rmap_ctx *ctx,
return 0; return 0;
XFREE(MTYPE_IF_RMAP_NAME, if_rmap->routemap[IF_RMAP_OUT]); XFREE(MTYPE_IF_RMAP_NAME, if_rmap->routemap[IF_RMAP_OUT]);
if_rmap->routemap[IF_RMAP_OUT] = NULL;
} }
if (ctx->if_rmap_delete_hook) if (ctx->if_rmap_delete_hook)

View File

@ -934,7 +934,6 @@ int zlog_reset_file(void)
zl->maxlvl[ZLOG_DEST_FILE] = ZLOG_DISABLED; zl->maxlvl[ZLOG_DEST_FILE] = ZLOG_DISABLED;
XFREE(MTYPE_ZLOG, zl->filename); XFREE(MTYPE_ZLOG, zl->filename);
zl->filename = NULL;
return 1; return 1;
} }

View File

@ -496,7 +496,6 @@ static void prefix_list_trie_del(struct prefix_list *plist,
for (; depth > 0; depth--) for (; depth > 0; depth--)
if (trie_table_empty(*tables[depth])) { if (trie_table_empty(*tables[depth])) {
XFREE(MTYPE_PREFIX_LIST_TRIE, *tables[depth]); XFREE(MTYPE_PREFIX_LIST_TRIE, *tables[depth]);
*tables[depth] = NULL;
} }
} }
@ -1095,7 +1094,6 @@ static int vty_prefix_list_desc_unset(struct vty *vty, afi_t afi,
if (plist->desc) { if (plist->desc) {
XFREE(MTYPE_TMP, plist->desc); XFREE(MTYPE_TMP, plist->desc);
plist->desc = NULL;
} }
if (plist->head == NULL && plist->tail == NULL && plist->desc == NULL) if (plist->head == NULL && plist->tail == NULL && plist->desc == NULL)

View File

@ -1081,7 +1081,6 @@ void prefix_free_lists(void *arg)
void prefix_free(struct prefix **p) void prefix_free(struct prefix **p)
{ {
XFREE(MTYPE_PREFIX, *p); XFREE(MTYPE_PREFIX, *p);
*p = NULL;
} }
/* Utility function to convert ipv4 prefixes to Classful prefixes */ /* Utility function to convert ipv4 prefixes to Classful prefixes */

View File

@ -2063,7 +2063,6 @@ static int route_map_dep_update(struct hash *dephash, const char *dep_name,
hash_free(dep->dep_rmap_hash); hash_free(dep->dep_rmap_hash);
XFREE(MTYPE_ROUTE_MAP_NAME, dep->dep_name); XFREE(MTYPE_ROUTE_MAP_NAME, dep->dep_name);
XFREE(MTYPE_ROUTE_MAP_DEP, dep); XFREE(MTYPE_ROUTE_MAP_DEP, dep);
dep = NULL;
} }
break; break;
case RMAP_EVENT_SET_ADDED: case RMAP_EVENT_SET_ADDED:

View File

@ -3013,12 +3013,10 @@ void vty_reset(void)
if (vty_accesslist_name) { if (vty_accesslist_name) {
XFREE(MTYPE_VTY, vty_accesslist_name); XFREE(MTYPE_VTY, vty_accesslist_name);
vty_accesslist_name = NULL;
} }
if (vty_ipv6_accesslist_name) { if (vty_ipv6_accesslist_name) {
XFREE(MTYPE_VTY, vty_ipv6_accesslist_name); XFREE(MTYPE_VTY, vty_ipv6_accesslist_name);
vty_ipv6_accesslist_name = NULL;
} }
} }

View File

@ -58,7 +58,6 @@ static void nhrp_route_update_put(struct route_node *rn)
if (!ri->ifp && !ri->nhrp_ifp if (!ri->ifp && !ri->nhrp_ifp
&& sockunion_family(&ri->via) == AF_UNSPEC) { && sockunion_family(&ri->via) == AF_UNSPEC) {
XFREE(MTYPE_NHRP_ROUTE, rn->info); XFREE(MTYPE_NHRP_ROUTE, rn->info);
rn->info = NULL;
route_unlock_node(rn); route_unlock_node(rn);
} }
route_unlock_node(rn); route_unlock_node(rn);

View File

@ -141,7 +141,6 @@ static void nhrp_shortcut_delete(struct nhrp_shortcut *s)
rn = route_node_lookup(shortcut_rib[afi], s->p); rn = route_node_lookup(shortcut_rib[afi], s->p);
if (rn) { if (rn) {
XFREE(MTYPE_NHRP_SHORTCUT, rn->info); XFREE(MTYPE_NHRP_SHORTCUT, rn->info);
rn->info = NULL;
route_unlock_node(rn); route_unlock_node(rn);
route_unlock_node(rn); route_unlock_node(rn);
} }

View File

@ -1518,12 +1518,10 @@ void ospf6_message_terminate(void)
{ {
if (recvbuf) { if (recvbuf) {
XFREE(MTYPE_OSPF6_MESSAGE, recvbuf); XFREE(MTYPE_OSPF6_MESSAGE, recvbuf);
recvbuf = NULL;
} }
if (sendbuf) { if (sendbuf) {
XFREE(MTYPE_OSPF6_MESSAGE, sendbuf); XFREE(MTYPE_OSPF6_MESSAGE, sendbuf);
sendbuf = NULL;
} }
iobuflen = 0; iobuflen = 0;

View File

@ -141,7 +141,6 @@ ospf_external_info_add(struct ospf *ospf, uint8_t type, unsigned short instance,
ospf->vrf_id, inet_ntoa(p.prefix), ospf->vrf_id, inet_ntoa(p.prefix),
p.prefixlen, inetbuf); p.prefixlen, inetbuf);
XFREE(MTYPE_OSPF_EXTERNAL_INFO, rn->info); XFREE(MTYPE_OSPF_EXTERNAL_INFO, rn->info);
rn->info = NULL;
} }
/* Create new External info instance. */ /* Create new External info instance. */

View File

@ -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)); ospf_del_if_params((struct ospf_if_params *)IF_DEF_PARAMS(ifp));
XFREE(MTYPE_OSPF_IF_INFO, ifp->info); XFREE(MTYPE_OSPF_IF_INFO, ifp->info);
ifp->info = NULL;
return rc; return rc;
} }

View File

@ -1210,7 +1210,6 @@ static int rip_interface_delete_hook(struct interface *ifp)
{ {
rip_interface_reset(ifp->info); rip_interface_reset(ifp->info);
XFREE(MTYPE_RIP_INTERFACE, ifp->info); XFREE(MTYPE_RIP_INTERFACE, ifp->info);
ifp->info = NULL;
return 0; return 0;
} }

View File

@ -913,7 +913,6 @@ static int ripng_if_new_hook(struct interface *ifp)
static int ripng_if_delete_hook(struct interface *ifp) static int ripng_if_delete_hook(struct interface *ifp)
{ {
XFREE(MTYPE_RIPNG_IF, ifp->info); XFREE(MTYPE_RIPNG_IF, ifp->info);
ifp->info = NULL;
return 0; return 0;
} }

View File

@ -81,7 +81,6 @@ static void slow_func_del(struct work_queue *wq, void *data)
assert(hn && hn->str); assert(hn && hn->str);
printf("%s: %s\n", __func__, hn->str); printf("%s: %s\n", __func__, hn->str);
XFREE(MTYPE_WQ_NODE_STR, hn->str); XFREE(MTYPE_WQ_NODE_STR, hn->str);
hn->str = NULL;
XFREE(MTYPE_WQ_NODE, hn); XFREE(MTYPE_WQ_NODE, hn);
} }

View File

@ -1153,7 +1153,6 @@ static char *command_generator(const char *text, int state)
return matched[index++]; return matched[index++];
XFREE(MTYPE_TMP, matched); XFREE(MTYPE_TMP, matched);
matched = NULL;
return NULL; return NULL;
} }

View File

@ -549,7 +549,6 @@ static void dplane_ctx_free(struct zebra_dplane_ctx **pctx)
} }
XFREE(MTYPE_DP_CTX, *pctx); XFREE(MTYPE_DP_CTX, *pctx);
*pctx = NULL;
} }
/* /*

View File

@ -711,7 +711,6 @@ static void nhg_ctx_free(struct nhg_ctx **ctx)
done: done:
XFREE(MTYPE_NHG_CTX, *ctx); XFREE(MTYPE_NHG_CTX, *ctx);
*ctx = NULL;
} }
static struct nhg_ctx *nhg_ctx_init(uint32_t id, struct nexthop *nh, static struct nhg_ctx *nhg_ctx_init(uint32_t id, struct nexthop *nh,

View File

@ -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) static void rib_update_ctx_fini(struct rib_update_ctx **ctx)
{ {
XFREE(MTYPE_RIB_UPDATE_CTX, *ctx); XFREE(MTYPE_RIB_UPDATE_CTX, *ctx);
*ctx = NULL;
} }
static int rib_update_handler(struct thread *thread) static int rib_update_handler(struct thread *thread)