]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: Memory allocations do not fail
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 4 May 2019 00:32:02 +0000 (20:32 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 3 May 2019 09:05:19 +0000 (05:05 -0400)
If a memory allocation fails then we *know* we assert
and core the program.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/zebra_dplane.c

index e6671bd87cef7e99bc9a7c18594eb5724851a5ec..ae52762c5a8b2690b07712be97bef5cffc97c8e2 100644 (file)
@@ -1344,10 +1344,6 @@ dplane_route_update_internal(struct route_node *rn,
 
        /* Obtain context block */
        ctx = dplane_ctx_alloc();
-       if (ctx == NULL) {
-               ret = ENOMEM;
-               goto done;
-       }
 
        /* Init context with info from zebra data structs */
        ret = dplane_ctx_route_init(ctx, op, rn, re);
@@ -1382,7 +1378,6 @@ dplane_route_update_internal(struct route_node *rn,
                ret = dplane_route_enqueue(ctx);
        }
 
-done:
        /* Update counter */
        atomic_fetch_add_explicit(&zdplane_info.dg_routes_in, 1,
                                  memory_order_relaxed);
@@ -1562,10 +1557,6 @@ static enum zebra_dplane_result lsp_update_internal(zebra_lsp_t *lsp,
 
        /* Obtain context block */
        ctx = dplane_ctx_alloc();
-       if (ctx == NULL) {
-               ret = ENOMEM;
-               goto done;
-       }
 
        ret = dplane_ctx_lsp_init(ctx, op, lsp);
        if (ret != AOK)
@@ -1601,10 +1592,6 @@ static enum zebra_dplane_result pw_update_internal(struct zebra_pw *pw,
        struct zebra_dplane_ctx *ctx = NULL;
 
        ctx = dplane_ctx_alloc();
-       if (ctx == NULL) {
-               ret = ENOMEM;
-               goto done;
-       }
 
        ret = dplane_ctx_pw_init(ctx, op, pw);
        if (ret != AOK)
@@ -1691,10 +1678,6 @@ static enum zebra_dplane_result intf_addr_update_internal(
        }
 
        ctx = dplane_ctx_alloc();
-       if (ctx == NULL) {
-               ret = ENOMEM;
-               goto done;
-       }
 
        ctx->zd_op = op;
        ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
@@ -1744,8 +1727,6 @@ static enum zebra_dplane_result intf_addr_update_internal(
 
        ret = dplane_route_enqueue(ctx);
 
-done:
-
        /* Increment counter */
        atomic_fetch_add_explicit(&zdplane_info.dg_intf_addrs_in, 1,
                                  memory_order_relaxed);