Ignore:
Timestamp:
Jan 10, 2020 8:02:54 AM (9 months ago)
Author:
nanang
Message:

Misc (re #2210): Fixed memory leak in OpenSSL initialization due to unfreed SSL_SESSION object. The leak should only be occurred once in library lifetime. Thanks to Kim Daeyoung for the report.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/ssl_sock_ossl.c

    r6104 r6133  
    491491        SSL *ssl; 
    492492        STACK_OF(SSL_CIPHER) *sk_cipher; 
     493        SSL_SESSION *ssl_sess; 
    493494        unsigned i, n; 
    494495        int nid; 
     
    538539        ssl_cipher_num = n; 
    539540 
    540         SSL_set_session(ssl, SSL_SESSION_new()); 
     541        ssl_sess = SSL_SESSION_new(); 
     542        SSL_set_session(ssl, ssl_sess); 
    541543 
    542544#if !USING_LIBRESSL && !defined(OPENSSL_NO_EC) \ 
     
    568570 
    569571        SSL_free(ssl); 
     572        SSL_SESSION_free(ssl_sess); 
    570573        SSL_CTX_free(ctx); 
    571574    } 
Note: See TracChangeset for help on using the changeset viewer.