diff options
Diffstat (limited to 'src/or/onion_fast.c')
-rw-r--r-- | src/or/onion_fast.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/or/onion_fast.c b/src/or/onion_fast.c index eb9eceba88..c1a05233e0 100644 --- a/src/or/onion_fast.c +++ b/src/or/onion_fast.c @@ -29,8 +29,11 @@ fast_onionskin_create(fast_handshake_state_t **handshake_state_out, uint8_t *handshake_out) { fast_handshake_state_t *s; - *handshake_state_out = s =tor_malloc(sizeof(fast_handshake_state_t)); - crypto_rand((char*)s->state, sizeof(s->state)); + *handshake_state_out = s = tor_malloc(sizeof(fast_handshake_state_t)); + if (crypto_rand((char*)s->state, sizeof(s->state)) < 0) { + tor_free(s); + return -1; + } memcpy(handshake_out, s->state, DIGEST_LEN); return 0; } |