Commit 9be80ad4 authored by Christian Kellner's avatar Christian Kellner

key: fix leak in case of the error condition

In case the random number generation fails, 'key' was leaked.
parent 549c80fe
......@@ -149,8 +149,6 @@ bolt_key_new (GError **error)
BoltRng rng;
char data[BOLT_KEY_BYTES];
key = g_object_new (BOLT_TYPE_KEY, NULL);
rng = bolt_get_random_data (data, BOLT_KEY_BYTES);
/* fail if we can not be sure that we have good enough
......@@ -162,6 +160,8 @@ bolt_key_new (GError **error)
return NULL;
key = g_object_new (BOLT_TYPE_KEY, NULL);
for (guint i = 0; i < BOLT_KEY_BYTES; i++)
char *pos = key->data + 2 * i;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment