summaryrefslogtreecommitdiff
path: root/lib/async_req
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2015-05-21 22:28:14 +0200
committerStefan Metzmacher <metze@samba.org>2015-06-12 17:08:18 +0200
commit9a116b28bab20507760f50f25214635a60ea6c43 (patch)
tree20b4c52c537519c3b4da580e1c181b7adf632362 /lib/async_req
parent4f05f68abc1d756bb114260e80d3532f3f959fec (diff)
downloadsamba-9a116b28bab20507760f50f25214635a60ea6c43.tar.gz
lib/async_req: use tevent_req_nomem/tevent_req_post in read_packet_send()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'lib/async_req')
-rw-r--r--lib/async_req/async_sock.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/async_req/async_sock.c b/lib/async_req/async_sock.c
index ebcedb5cbd1..19278f652e0 100644
--- a/lib/async_req/async_sock.c
+++ b/lib/async_req/async_sock.c
@@ -410,19 +410,16 @@ struct tevent_req *read_packet_send(TALLOC_CTX *mem_ctx,
state->private_data = private_data;
state->buf = talloc_array(state, uint8_t, initial);
- if (state->buf == NULL) {
- goto fail;
+ if (tevent_req_nomem(state->buf, req)) {
+ return tevent_req_post(req, ev);
}
fde = tevent_add_fd(ev, state, fd, TEVENT_FD_READ, read_packet_handler,
req);
- if (fde == NULL) {
- goto fail;
+ if (tevent_req_nomem(fde, req)) {
+ return tevent_req_post(req, ev);
}
return req;
- fail:
- TALLOC_FREE(req);
- return NULL;
}
static void read_packet_handler(struct tevent_context *ev,