MINOR: buffer: only use b_free to release buffers

We don't call pool_free2(pool2_buffers) anymore, we only call b_free()
to do the job. This ensures that we can start to centralize the releasing
of buffers.
This commit is contained in:
Willy Tarreau 2014-11-25 19:45:11 +01:00
parent 696a2910a0
commit 7dfca9daec
3 changed files with 12 additions and 5 deletions

View File

@ -409,6 +409,13 @@ static inline struct buffer *b_alloc(struct buffer **buf)
return *buf;
}
/* Releases buffer *buf.
*/
static inline void b_free(struct buffer **buf)
{
pool_free2(pool2_buffer, *buf);
}
#endif /* _COMMON_BUFFER_H */
/*

View File

@ -1302,7 +1302,7 @@ static struct session *peer_session_create(struct peer *peer, struct peer_sessio
out_fail_rep_buf:
pool_free2(pool2_channel, s->rep);
out_fail_rep:
pool_free2(pool2_buffer, s->req->buf);
b_free(&s->req->buf);
out_fail_req_buf:
pool_free2(pool2_channel, s->req);
out_fail_req:

View File

@ -565,11 +565,11 @@ int session_complete(struct session *s)
/* Error unrolling */
out_free_rep_buf:
pool_free2(pool2_buffer, s->rep->buf);
b_free(&s->rep->buf);
out_free_rep:
pool_free2(pool2_channel, s->rep);
out_free_req_buf:
pool_free2(pool2_buffer, s->req->buf);
b_free(&s->req->buf);
out_free_req:
pool_free2(pool2_channel, s->req);
out_free_task:
@ -618,8 +618,8 @@ static void session_free(struct session *s)
if (s->rep->pipe)
put_pipe(s->rep->pipe);
pool_free2(pool2_buffer, s->req->buf);
pool_free2(pool2_buffer, s->rep->buf);
b_free(&s->req->buf);
b_free(&s->rep->buf);
pool_free2(pool2_channel, s->req);
pool_free2(pool2_channel, s->rep);