summaryrefslogtreecommitdiffstats
path: root/bfdd
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2019-02-25 20:43:09 +0100
committerQuentin Young <qlyoung@cumulusnetworks.com>2019-02-26 00:00:44 +0100
commit76f014689093aa8eecc1061e13cc4f8694967a12 (patch)
treed68df7e97b46f672cd944e89e62d823149781d07 /bfdd
parent*: use array_size instead of raw division (diff)
downloadfrr-76f014689093aa8eecc1061e13cc4f8694967a12.tar.xz
frr-76f014689093aa8eecc1061e13cc4f8694967a12.zip
*: do not check XMALLOC / XCALLOC for null ret
They never return NULL Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'bfdd')
-rw-r--r--bfdd/bfd.c2
-rw-r--r--bfdd/config.c2
-rw-r--r--bfdd/control.c25
-rw-r--r--bfdd/ptm_adapter.c4
4 files changed, 0 insertions, 33 deletions
diff --git a/bfdd/bfd.c b/bfdd/bfd.c
index afd5d814a..be6f2caa4 100644
--- a/bfdd/bfd.c
+++ b/bfdd/bfd.c
@@ -551,8 +551,6 @@ static struct bfd_session *bfd_session_new(void)
struct bfd_session *bs;
bs = XCALLOC(MTYPE_BFDD_CONFIG, sizeof(*bs));
- if (bs == NULL)
- return NULL;
QOBJ_REG(bs, bfd_session);
diff --git a/bfdd/config.c b/bfdd/config.c
index d1342eff1..17e155e41 100644
--- a/bfdd/config.c
+++ b/bfdd/config.c
@@ -574,8 +574,6 @@ struct peer_label *pl_new(const char *label, struct bfd_session *bs)
struct peer_label *pl;
pl = XCALLOC(MTYPE_BFDD_LABEL, sizeof(*pl));
- if (pl == NULL)
- return NULL;
if (strlcpy(pl->pl_label, label, sizeof(pl->pl_label))
> sizeof(pl->pl_label))
diff --git a/bfdd/control.c b/bfdd/control.c
index 40f4f4d3b..c308d647d 100644
--- a/bfdd/control.c
+++ b/bfdd/control.c
@@ -186,8 +186,6 @@ struct bfd_control_socket *control_new(int sd)
struct bfd_control_socket *bcs;
bcs = XCALLOC(MTYPE_BFDD_CONTROL, sizeof(*bcs));
- if (bcs == NULL)
- return NULL;
/* Disable notifications by default. */
bcs->bcs_notify = 0;
@@ -247,10 +245,6 @@ struct bfd_notify_peer *control_notifypeer_new(struct bfd_control_socket *bcs,
return bnp;
bnp = XCALLOC(MTYPE_BFDD_CONTROL, sizeof(*bnp));
- if (bnp == NULL) {
- log_warning("%s: calloc: %s", __func__, strerror(errno));
- return NULL;
- }
TAILQ_INSERT_TAIL(&bcs->bcs_bnplist, bnp, bnp_entry);
bnp->bnp_bs = bs;
@@ -285,10 +279,6 @@ struct bfd_control_queue *control_queue_new(struct bfd_control_socket *bcs)
struct bfd_control_queue *bcq;
bcq = XCALLOC(MTYPE_BFDD_NOTIFICATION, sizeof(*bcq));
- if (bcq == NULL) {
- log_warning("%s: calloc: %s", __func__, strerror(errno));
- return NULL;
- }
control_reset_buf(&bcq->bcq_bcb);
TAILQ_INSERT_TAIL(&bcs->bcs_bcqueue, bcq, bcq_entry);
@@ -743,11 +733,6 @@ static void control_response(struct bfd_control_socket *bcs, uint16_t id,
jsonstrlen = strlen(jsonstr);
bcm = XMALLOC(MTYPE_BFDD_NOTIFICATION,
sizeof(struct bfd_control_msg) + jsonstrlen);
- if (bcm == NULL) {
- log_warning("%s: malloc: %s", __func__, strerror(errno));
- XFREE(MTYPE_BFDD_NOTIFICATION, jsonstr);
- return;
- }
bcm->bcm_length = htonl(jsonstrlen);
bcm->bcm_ver = BMV_VERSION_1;
@@ -778,11 +763,6 @@ static void _control_notify(struct bfd_control_socket *bcs,
jsonstrlen = strlen(jsonstr);
bcm = XMALLOC(MTYPE_BFDD_NOTIFICATION,
sizeof(struct bfd_control_msg) + jsonstrlen);
- if (bcm == NULL) {
- log_warning("%s: malloc: %s", __func__, strerror(errno));
- XFREE(MTYPE_BFDD_NOTIFICATION, jsonstr);
- return;
- }
bcm->bcm_length = htonl(jsonstrlen);
bcm->bcm_ver = BMV_VERSION_1;
@@ -846,11 +826,6 @@ static void _control_notify_config(struct bfd_control_socket *bcs,
jsonstrlen = strlen(jsonstr);
bcm = XMALLOC(MTYPE_BFDD_NOTIFICATION,
sizeof(struct bfd_control_msg) + jsonstrlen);
- if (bcm == NULL) {
- log_warning("%s: malloc: %s", __func__, strerror(errno));
- XFREE(MTYPE_BFDD_NOTIFICATION, jsonstr);
- return;
- }
bcm->bcm_length = htonl(jsonstrlen);
bcm->bcm_ver = BMV_VERSION_1;
diff --git a/bfdd/ptm_adapter.c b/bfdd/ptm_adapter.c
index 3f1512d8e..5610c352f 100644
--- a/bfdd/ptm_adapter.c
+++ b/bfdd/ptm_adapter.c
@@ -752,8 +752,6 @@ static struct ptm_client *pc_new(uint32_t pid)
/* Allocate the client data and save it. */
pc = XCALLOC(MTYPE_BFDD_CONTROL, sizeof(*pc));
- if (pc == NULL)
- return NULL;
pc->pc_pid = pid;
TAILQ_INSERT_HEAD(&pcqueue, pc, pc_entry);
@@ -799,8 +797,6 @@ static struct ptm_client_notification *pcn_new(struct ptm_client *pc,
/* Save the client notification data. */
pcn = XCALLOC(MTYPE_BFDD_NOTIFICATION, sizeof(*pcn));
- if (pcn == NULL)
- return NULL;
TAILQ_INSERT_HEAD(&pc->pc_pcnqueue, pcn, pcn_entry);
pcn->pcn_pc = pc;