summaryrefslogtreecommitdiffstats
path: root/src/handshake.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-01-21 19:07:56 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-01-21 19:07:56 +0100
commit998300562e14f9d07293ec41e1aecca5930d5e6d (patch)
treeb7d6fdaa365aaefa98c39483052bb94064660a28 /src/handshake.c
parent96c3ad683d87918fd0e6451d37934ba8b1d03867 (diff)
downloadfastd-998300562e14f9d07293ec41e1aecca5930d5e6d.tar
fastd-998300562e14f9d07293ec41e1aecca5930d5e6d.zip
Add error message for OOM on buffer alloc
Diffstat (limited to 'src/handshake.c')
-rw-r--r--src/handshake.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/handshake.c b/src/handshake.c
index ad19f8a..9273972 100644
--- a/src/handshake.c
+++ b/src/handshake.c
@@ -92,7 +92,7 @@ fastd_buffer_t fastd_handshake_new_init(fastd_context_t *ctx, size_t tail_space)
size_t method_list_len;
uint8_t *method_list = create_method_list(ctx, &method_list_len);
- fastd_buffer_t buffer = fastd_buffer_alloc(sizeof(fastd_packet_t), 0,
+ fastd_buffer_t buffer = fastd_buffer_alloc(ctx, sizeof(fastd_packet_t), 0,
2*5 + /* handshake type, mode */
6 + /* MTU */
4+version_len + /* version name */
@@ -143,7 +143,7 @@ fastd_buffer_t fastd_handshake_new_reply(fastd_context_t *ctx, const fastd_hands
extra_size = 6 + /* MTU */
4+version_len; /* version name */
- fastd_buffer_t buffer = fastd_buffer_alloc(sizeof(fastd_packet_t), 0,
+ fastd_buffer_t buffer = fastd_buffer_alloc(ctx, sizeof(fastd_packet_t), 0,
2*5 + /* handshake type, reply code */
4+method_len + /* method name */
extra_size +
@@ -294,7 +294,7 @@ void fastd_handshake_handle(fastd_context_t *ctx, fastd_socket_t *sock, const fa
send_reply:
if (reply_code) {
- fastd_buffer_t reply_buffer = fastd_buffer_alloc(sizeof(fastd_packet_t), 0, 3*5 /* enough space for handshake type, reply code and error detail */);
+ fastd_buffer_t reply_buffer = fastd_buffer_alloc(ctx, sizeof(fastd_packet_t), 0, 3*5 /* enough space for handshake type, reply code and error detail */);
fastd_packet_t *reply = reply_buffer.data;
reply->rsv1 = 0;