Changeset 4583

Show
Ignore:
Timestamp:
11/05/08 13:37:37 (2 months ago)
Author:
martin
Message:

proper cleanup of openssl locking code

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/libstrongswan/plugins/openssl/openssl_plugin.c

    r4579 r4583  
    5151 * Array of static mutexs, with CRYPTO_num_locks() mutex 
    5252 */ 
    53 static mutex_t **mutex
     53static mutex_t **mutex = NULL
    5454 
    5555/** 
     
    5858static void locking_function(int mode, int type, const char *file, int line) 
    5959{ 
    60     if (mode & CRYPTO_LOCK) 
    61     { 
    62         mutex[type]->lock(mutex[type]); 
    63     } 
    64     else 
    65     { 
    66         mutex[type]->unlock(mutex[type]); 
     60    if (mutex) 
     61    { 
     62        if (mode & CRYPTO_LOCK) 
     63        { 
     64            mutex[type]->lock(mutex[type]); 
     65        } 
     66        else 
     67        { 
     68            mutex[type]->unlock(mutex[type]); 
     69        } 
    6770    } 
    6871} 
     
    156159    } 
    157160    free(mutex); 
     161    mutex = NULL; 
    158162} 
    159163 
     
    182186    ENGINE_cleanup(); 
    183187    EVP_cleanup(); 
     188     
     189    threading_cleanup(); 
    184190     
    185191    free(this);