summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Hák <jan.hak@nic.cz>2024-11-26 12:56:51 +0100
committerDaniel Salzman <daniel.salzman@nic.cz>2024-12-11 17:36:20 +0100
commit69669d5349d6a1bef72b783c5abe86a76f58d8aa (patch)
tree3ab75232fbdf87c6b5fdd63b756e8c02daddb082 /src
parentlibknot/quic: fix usage of new atomic in code (variable obufs_size) (diff)
downloadknot-69669d5349d6a1bef72b783c5abe86a76f58d8aa.tar.xz
knot-69669d5349d6a1bef72b783c5abe86a76f58d8aa.zip
libknot/quic: fix usage of new atomic in code (variable cert_creds)
Diffstat (limited to 'src')
-rw-r--r--src/libknot/quic/tls_common.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libknot/quic/tls_common.c b/src/libknot/quic/tls_common.c
index a1158e5ed..45f02bc72 100644
--- a/src/libknot/quic/tls_common.c
+++ b/src/libknot/quic/tls_common.c
@@ -196,7 +196,7 @@ struct knot_creds *knot_creds_init_peer(const struct knot_creds *local_creds,
if (local_creds != NULL) {
creds->peer = true;
- creds->cert_creds = ATOMIC_GET(local_creds->cert_creds);
+ ATOMIC_INIT(creds->cert_creds, ATOMIC_GET(local_creds->cert_creds));
} else {
gnutls_certificate_credentials_t new_creds;
int ret = gnutls_certificate_allocate_credentials(&new_creds);
@@ -204,7 +204,7 @@ struct knot_creds *knot_creds_init_peer(const struct knot_creds *local_creds,
free(creds);
return NULL;
}
- creds->cert_creds = new_creds;
+ ATOMIC_INIT(creds->cert_creds, new_creds);
}
if (peer_pin_len > 0 && peer_pin != NULL) {
@@ -345,8 +345,9 @@ void knot_creds_free(struct knot_creds *creds)
return;
}
- if (!creds->peer && creds->cert_creds != NULL) {
- gnutls_certificate_free_credentials(creds->cert_creds);
+ if (!creds->peer && ATOMIC_GET(creds->cert_creds) != NULL) {
+ gnutls_certificate_free_credentials(ATOMIC_GET(creds->cert_creds));
+ ATOMIC_DEINIT(creds->cert_creds);
if (creds->cert_creds_prev != NULL) {
gnutls_certificate_free_credentials(creds->cert_creds_prev);
}