summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-06-19 22:17:09 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2018-08-11 19:58:23 +0200
commit131437016632929f3a31f45bfe934b9b43235c71 (patch)
tree849f5e4ab9d5ba954d3969a4876444133a3abc4d /tests/lib
parentlib: Remove memory check test (diff)
downloadfrr-131437016632929f3a31f45bfe934b9b43235c71.tar.xz
frr-131437016632929f3a31f45bfe934b9b43235c71.zip
tests: Cleanup assumption that ALLOC could fail.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/test_heavy_thread.c11
-rw-r--r--tests/lib/test_heavy_wq.c17
2 files changed, 5 insertions, 23 deletions
diff --git a/tests/lib/test_heavy_thread.c b/tests/lib/test_heavy_thread.c
index 075bcb6da..b3c6e4c2f 100644
--- a/tests/lib/test_heavy_thread.c
+++ b/tests/lib/test_heavy_thread.c
@@ -110,16 +110,9 @@ DEFUN (clear_foo,
str = argv_concat(argv, argc, 0);
- if ((ws = XMALLOC(MTYPE_TMP, sizeof(*ws))) == NULL) {
- zlog_err("%s: unable to allocate work_state", __func__);
- return CMD_WARNING;
- }
+ ws = XMALLOC(MTYPE_TMP, sizeof(*ws));
- if (!(ws->str = XSTRDUP(MTYPE_TMP, str))) {
- zlog_err("%s: unable to xstrdup", __func__);
- XFREE(MTYPE_TMP, ws);
- return CMD_WARNING;
- }
+ ws->str = XSTRDUP(MTYPE_TMP, str);
ws->vty = vty;
ws->i = ITERS_FIRST;
diff --git a/tests/lib/test_heavy_wq.c b/tests/lib/test_heavy_wq.c
index 0f474dc5d..00ddc836d 100644
--- a/tests/lib/test_heavy_wq.c
+++ b/tests/lib/test_heavy_wq.c
@@ -60,18 +60,10 @@ static void heavy_wq_add(struct vty *vty, const char *str, int i)
{
struct heavy_wq_node *hn;
- if ((hn = XCALLOC(MTYPE_WQ_NODE, sizeof(struct heavy_wq_node)))
- == NULL) {
- zlog_err("%s: unable to allocate hn", __func__);
- return;
- }
+ hn = XCALLOC(MTYPE_WQ_NODE, sizeof(struct heavy_wq_node));
hn->i = i;
- if (!(hn->str = XSTRDUP(MTYPE_WQ_NODE_STR, str))) {
- zlog_err("%s: unable to xstrdup", __func__);
- XFREE(MTYPE_WQ_NODE, hn);
- return;
- }
+ hn->str = XSTRDUP(MTYPE_WQ_NODE_STR, str);
work_queue_add(heavy_wq, hn);
@@ -149,10 +141,7 @@ DEFUN (clear_foo,
static int heavy_wq_init()
{
- if (!(heavy_wq = work_queue_new(master, "heavy_work_queue"))) {
- zlog_err("%s: could not get new work queue!", __func__);
- return -1;
- }
+ heavy_wq = work_queue_new(master, "heavy_work_queue");
heavy_wq->spec.workfunc = &slow_func;
heavy_wq->spec.errorfunc = &slow_func_err;