Просмотр исходного кода

cdp: don't try to cleanup_ssl when no there's no tls info

> Program terminated with signal SIGSEGV, Segmentation fault.
> #0  0x00007fa6326b3a95 in SSL_shutdown () from /lib/x86_64-linux-gnu/libssl.so.3
> (gdb) bt
> #0  0x00007fa6326b3a95 in SSL_shutdown () from /lib/x86_64-linux-gnu/libssl.so.3
> #1  0x00007fa6327582d5 in cleanup_ssl (tls_ctx=0x0, tls_conn=0x0) at cdp_tls.c:259
> #2  0x00007fa6327a30a7 in receive_loop (original_peer=0x7fa612199860) at receiver.c:890
> #3  0x00007fa63279b5cb in receiver_process (p=0x7fa612199860) at receiver.c:485
> #4  0x00007fa63277e2b1 in diameter_peer_start (blocking=0) at diameter_peer.c:294
> #5  0x00007fa63274ea8f in cdp_child_init (rank=0) at cdp_mod.c:275
> ...
> (gdb) p sp->tls_conn
> $5 = (SSL *) 0x0
> (gdb) p sp->tls_ctx
> $6 = (SSL_CTX *) 0x0
Victor Seva 5 дней назад
Родитель
Сommit
cb0f9a9ac4
1 измененных файлов с 7 добавлено и 3 удалено
  1. 7 3
      src/modules/cdp/cdp_tls.c

+ 7 - 3
src/modules/cdp/cdp_tls.c

@@ -256,9 +256,13 @@ cleanup:
 #if OPENSSL_VERSION_NUMBER >= 0x10100000L
 void cleanup_ssl(SSL_CTX *tls_ctx, SSL *tls_conn)
 {
-	SSL_shutdown(tls_conn);
-	SSL_free(tls_conn);
-	SSL_CTX_free(tls_ctx);
+	if(tls_conn) {
+		SSL_shutdown(tls_conn);
+		SSL_free(tls_conn);
+	}
+	if(tls_ctx) {
+		SSL_CTX_free(tls_ctx);
+	}
 }
 #endif