diff options
author | David Lamparter <equinox@diac24.net> | 2019-03-06 15:54:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-06 15:54:44 +0100 |
commit | d3b05897edff14ceb71c2f5603a9fcdb1ae10c83 (patch) | |
tree | 274b088939d9686c289d5de95d70cdb39a01e4b4 /lib/if_rmap.c | |
parent | Revert "nhrpd: strncpy -> strlcpy" (diff) | |
parent | tools: add coccinelle spatches (diff) | |
download | frr-d3b05897edff14ceb71c2f5603a9fcdb1ae10c83.tar.xz frr-d3b05897edff14ceb71c2f5603a9fcdb1ae10c83.zip |
Merge pull request #3869 from qlyoung/cocci-fixes
Assorted Coccinelle fixes
Diffstat (limited to 'lib/if_rmap.c')
-rw-r--r-- | lib/if_rmap.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/lib/if_rmap.c b/lib/if_rmap.c index 53bbcbfe5..955c1417c 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -44,13 +44,10 @@ static struct if_rmap *if_rmap_new(void) static void if_rmap_free(struct if_rmap *if_rmap) { - if (if_rmap->ifname) - XFREE(MTYPE_IF_RMAP_NAME, if_rmap->ifname); + XFREE(MTYPE_IF_RMAP_NAME, if_rmap->ifname); - if (if_rmap->routemap[IF_RMAP_IN]) - XFREE(MTYPE_IF_RMAP_NAME, if_rmap->routemap[IF_RMAP_IN]); - if (if_rmap->routemap[IF_RMAP_OUT]) - XFREE(MTYPE_IF_RMAP_NAME, if_rmap->routemap[IF_RMAP_OUT]); + XFREE(MTYPE_IF_RMAP_NAME, if_rmap->routemap[IF_RMAP_IN]); + XFREE(MTYPE_IF_RMAP_NAME, if_rmap->routemap[IF_RMAP_OUT]); XFREE(MTYPE_IF_RMAP, if_rmap); } @@ -65,8 +62,7 @@ struct if_rmap *if_rmap_lookup(struct if_rmap_ctx *ctx, const char *ifname) if_rmap = hash_lookup(ctx->ifrmaphash, &key); - if (key.ifname) - XFREE(MTYPE_IF_RMAP_NAME, key.ifname); + XFREE(MTYPE_IF_RMAP_NAME, key.ifname); return if_rmap; } @@ -106,8 +102,7 @@ static struct if_rmap *if_rmap_get(struct if_rmap_ctx *ctx, const char *ifname) ret = hash_get(ctx->ifrmaphash, &key, if_rmap_hash_alloc); - if (key.ifname) - XFREE(MTYPE_IF_RMAP_NAME, key.ifname); + XFREE(MTYPE_IF_RMAP_NAME, key.ifname); return ret; } @@ -136,16 +131,12 @@ static struct if_rmap *if_rmap_set(struct if_rmap_ctx *ctx, if_rmap = if_rmap_get(ctx, ifname); if (type == IF_RMAP_IN) { - if (if_rmap->routemap[IF_RMAP_IN]) - 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] = XSTRDUP(MTYPE_IF_RMAP_NAME, routemap_name); } if (type == IF_RMAP_OUT) { - if (if_rmap->routemap[IF_RMAP_OUT]) - 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] = XSTRDUP(MTYPE_IF_RMAP_NAME, routemap_name); } |