summaryrefslogtreecommitdiffstats
path: root/src/handshake.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-08-02 00:53:47 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-08-02 00:53:47 +0200
commit546ac7936340312cf272969ff83317ae4d50d2b4 (patch)
tree7ecadca11430c8624d9f80aae7c348fa4d65b969 /src/handshake.c
parentb22364f4af3564f0dd9a5f4e150bb09747bd5c4e (diff)
downloadfastd-546ac7936340312cf272969ff83317ae4d50d2b4.tar
fastd-546ac7936340312cf272969ff83317ae4d50d2b4.zip
Introduce and use alloc helpers
These new helpers will terminate fastd on allocation failures and add some additional convenience (allow strdup with NULL; typesafe new(type) macros).
Diffstat (limited to 'src/handshake.c')
-rw-r--r--src/handshake.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/handshake.c b/src/handshake.c
index e8b2197..23c9f4e 100644
--- a/src/handshake.c
+++ b/src/handshake.c
@@ -72,7 +72,7 @@ static uint8_t* create_method_list(size_t *len) {
for (i = 0; conf.methods[i].name; i++)
*len += strlen(conf.methods[i].name) + 1;
- uint8_t *ret = malloc(*len);
+ uint8_t *ret = fastd_alloc(*len);
(*len)--;
char *ptr = (char*)ret;
@@ -364,7 +364,7 @@ void fastd_handshake_handle(fastd_socket_t *sock, const fastd_peer_address_t *lo
method = get_method(&handshake);
if (handshake.records[RECORD_VERSION_NAME].data)
- handshake.peer_version = peer_version = strndup((const char*)handshake.records[RECORD_VERSION_NAME].data, handshake.records[RECORD_VERSION_NAME].length);
+ handshake.peer_version = peer_version = fastd_strndup((const char*)handshake.records[RECORD_VERSION_NAME].data, handshake.records[RECORD_VERSION_NAME].length);
}
if (handshake.type > 1 && !method) {