From 130f5cd0fca0f387bb63d0bdaa773b98089a2168 Mon Sep 17 00:00:00 2001 From: Sergey Safarov Date: Mon, 11 Feb 2019 15:37:15 +0300 Subject: [PATCH] src/core/tcp_main.c: Fixed #1836 after regression introduced e3ecad34bb13e72b16a4213e7ce785194e88c534 --- src/core/tcp_main.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c index 7266c63ceaf..c412ef7b682 100644 --- a/src/core/tcp_main.c +++ b/src/core/tcp_main.c @@ -642,9 +642,10 @@ inline static int _wbufq_add(struct tcp_connection* c, const char* data, if (unlikely(q->last==0)){ wb_size=MAX_unsigned(cfg_get(tcp, tcp_cfg, wq_blk_size), size); wb=shm_malloc(sizeof(*wb)+wb_size-1); - if (unlikely(wb==0)) - SHM_MEM_ERROR; + if (unlikely(wb==0)) { + SHM_MEM_ERROR; goto error; + } wb->b_size=wb_size; wb->next=0; q->last=wb; @@ -664,9 +665,10 @@ inline static int _wbufq_add(struct tcp_connection* c, const char* data, if (last_free==0){ wb_size=MAX_unsigned(cfg_get(tcp, tcp_cfg, wq_blk_size), size); wb=shm_malloc(sizeof(*wb)+wb_size-1); - if (unlikely(wb==0)) - SHM_MEM_ERROR; + if (unlikely(wb==0)) { + SHM_MEM_ERROR; goto error; + } wb->b_size=wb_size; wb->next=0; q->last->next=wb; @@ -724,9 +726,10 @@ inline static int _wbufq_insert(struct tcp_connection* c, const char* data, }else{ /* create a size bytes block directly */ wb=shm_malloc(sizeof(*wb)+size-1); - if (unlikely(wb==0)) - SHM_MEM_ERROR; + if (unlikely(wb==0)) { + SHM_MEM_ERROR; goto error; + } wb->b_size=size; /* insert it */ wb->next=q->first;