Commit 90e397b8 authored by Grigorii Demidov's avatar Grigorii Demidov Committed by Petr Špaček

daemon/tls_ephemeral_credentials: avoid some memory leaks

parent 01c688e2
......@@ -114,6 +114,8 @@ static gnutls_x509_privkey_t get_ephemeral_privkey ()
bad_data:
close(datafd);
datafd = -1;
}
if (data.data != NULL) {
gnutls_free(data.data);
data.data = NULL;
}
......@@ -150,8 +152,12 @@ static gnutls_x509_privkey_t get_ephemeral_privkey ()
}
done:
_lock_unlock(&lock, EPHEMERAL_PRIVKEY_FILENAME ".lock");
if (datafd != -1)
if (datafd != -1) {
close(datafd);
}
if (data.data != NULL) {
gnutls_free(data.data);
}
return privkey;
}
......
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