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/distribute.c | |
| parent | b19abe1131daa38d1d0e31c4793925bb89f11c07 (diff) | |
| parent | 25af5f0d79f9e5595b1ba3bb04a0aff876471029 (diff) | |
Merge pull request #3869 from qlyoung/cocci-fixes
Assorted Coccinelle fixes
Diffstat (limited to 'lib/distribute.c')
| -rw-r--r-- | lib/distribute.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/lib/distribute.c b/lib/distribute.c index 7cc10a230d..fa8ac5242e 100644 --- a/lib/distribute.c +++ b/lib/distribute.c @@ -44,16 +44,15 @@ static void distribute_free(struct distribute *dist) { int i = 0; - if (dist->ifname) - XFREE(MTYPE_DISTRIBUTE_IFNAME, dist->ifname); + XFREE(MTYPE_DISTRIBUTE_IFNAME, dist->ifname); - for (i = 0; i < DISTRIBUTE_MAX; i++) - if (dist->list[i]) - XFREE(MTYPE_DISTRIBUTE_NAME, dist->list[i]); + for (i = 0; i < DISTRIBUTE_MAX; i++) { + XFREE(MTYPE_DISTRIBUTE_NAME, dist->list[i]); + } - for (i = 0; i < DISTRIBUTE_MAX; i++) - if (dist->prefix[i]) - XFREE(MTYPE_DISTRIBUTE_NAME, dist->prefix[i]); + for (i = 0; i < DISTRIBUTE_MAX; i++) { + XFREE(MTYPE_DISTRIBUTE_NAME, dist->prefix[i]); + } XFREE(MTYPE_DISTRIBUTE, dist); } @@ -83,8 +82,7 @@ struct distribute *distribute_lookup(struct distribute_ctx *ctx, dist = hash_lookup(ctx->disthash, &key); - if (key.ifname) - XFREE(MTYPE_DISTRIBUTE_IFNAME, key.ifname); + XFREE(MTYPE_DISTRIBUTE_IFNAME, key.ifname); return dist; } @@ -128,8 +126,7 @@ static struct distribute *distribute_get(struct distribute_ctx *ctx, ret = hash_get(ctx->disthash, &key, (void *(*)(void *))distribute_hash_alloc); - if (key.ifname) - XFREE(MTYPE_DISTRIBUTE_IFNAME, key.ifname); + XFREE(MTYPE_DISTRIBUTE_IFNAME, key.ifname); return ret; } @@ -163,8 +160,7 @@ static void distribute_list_set(struct distribute_ctx *ctx, dist = distribute_get(ctx, ifname); - if (dist->list[type]) - XFREE(MTYPE_DISTRIBUTE_NAME, dist->list[type]); + XFREE(MTYPE_DISTRIBUTE_NAME, dist->list[type]); dist->list[type] = XSTRDUP(MTYPE_DISTRIBUTE_NAME, alist_name); /* Apply this distribute-list to the interface. */ @@ -210,8 +206,7 @@ static void distribute_list_prefix_set(struct distribute_ctx *ctx, dist = distribute_get(ctx, ifname); - if (dist->prefix[type]) - XFREE(MTYPE_DISTRIBUTE_NAME, dist->prefix[type]); + XFREE(MTYPE_DISTRIBUTE_NAME, dist->prefix[type]); dist->prefix[type] = XSTRDUP(MTYPE_DISTRIBUTE_NAME, plist_name); /* Apply this distribute-list to the interface. */ |
