summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_buf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nxt_buf.c')
-rw-r--r--src/nxt_buf.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nxt_buf.c b/src/nxt_buf.c
index 7bc983a3..36a1dcd0 100644
--- a/src/nxt_buf.c
+++ b/src/nxt_buf.c
@@ -59,11 +59,13 @@ nxt_buf_mem_ts_alloc(nxt_task_t *task, nxt_mp_t *mp, size_t size)
nxt_buf_t *b;
nxt_buf_ts_t *ts;
- b = nxt_mp_retain(mp, NXT_BUF_MEM_SIZE + sizeof(nxt_buf_ts_t) + size);
+ b = nxt_mp_alloc(mp, NXT_BUF_MEM_SIZE + sizeof(nxt_buf_ts_t) + size);
if (nxt_slow_path(b == NULL)) {
return NULL;
}
+ nxt_mp_retain(mp);
+
nxt_memzero(b, NXT_BUF_MEM_SIZE + sizeof(nxt_buf_ts_t));
b->data = mp;
@@ -284,7 +286,8 @@ nxt_buf_ts_completion(nxt_task_t *task, void *obj, void *data)
#endif
mp = b->data;
- nxt_mp_release(mp, b);
+ nxt_mp_free(mp, b);
+ nxt_mp_release(mp);
if (parent != NULL) {
nxt_debug(task, "parent retain:%uD", parent->retain);