summaryrefslogtreecommitdiffstats
path: root/lib/prefix.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2019-03-06 15:54:44 +0100
committerGitHub <noreply@github.com>2019-03-06 15:54:44 +0100
commitd3b05897edff14ceb71c2f5603a9fcdb1ae10c83 (patch)
tree274b088939d9686c289d5de95d70cdb39a01e4b4 /lib/prefix.c
parentRevert "nhrpd: strncpy -> strlcpy" (diff)
parenttools: add coccinelle spatches (diff)
downloadfrr-d3b05897edff14ceb71c2f5603a9fcdb1ae10c83.tar.xz
frr-d3b05897edff14ceb71c2f5603a9fcdb1ae10c83.zip
Merge pull request #3869 from qlyoung/cocci-fixes
Assorted Coccinelle fixes
Diffstat (limited to 'lib/prefix.c')
-rw-r--r--lib/prefix.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/prefix.c b/lib/prefix.c
index 80a89cc3c..52bb266f1 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -944,8 +944,7 @@ int str2prefix_eth(const char *str, struct prefix_eth *p)
ret = 1;
done:
- if (cp)
- XFREE(MTYPE_TMP, cp);
+ XFREE(MTYPE_TMP, cp);
return ret;
}
@@ -1503,8 +1502,7 @@ char *prefix_mac2str(const struct ethaddr *mac, char *buf, int size)
if (!mac)
return NULL;
if (!buf)
- ptr = (char *)XMALLOC(MTYPE_TMP,
- ETHER_ADDR_STRLEN * sizeof(char));
+ ptr = XMALLOC(MTYPE_TMP, ETHER_ADDR_STRLEN * sizeof(char));
else {
assert(size >= ETHER_ADDR_STRLEN);
ptr = buf;
@@ -1585,8 +1583,7 @@ char *esi_to_str(const esi_t *esi, char *buf, int size)
if (!esi)
return NULL;
if (!buf)
- ptr = (char *)XMALLOC(MTYPE_TMP,
- ESI_STR_LEN * sizeof(char));
+ ptr = XMALLOC(MTYPE_TMP, ESI_STR_LEN * sizeof(char));
else {
assert(size >= ESI_STR_LEN);
ptr = buf;