Commit db7b5e0d authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Add function to free compression methods.

Although the memory allocated by compression methods is fixed and
cannot grow over time it can cause warnings in some leak checking
tools. The function SSL_COMP_free_compression_methods() will free
and zero the list of supported compression methods. This should
*only* be called in a single threaded context when an application
is shutting down to avoid interfering with existing contexts
attempting to look up compression methods.
(cherry picked from commit 976c5830)
parent 65370f9b
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -2512,6 +2512,7 @@ const COMP_METHOD *SSL_get_current_expansion(SSL *s);
const char *SSL_COMP_get_name(const COMP_METHOD *comp);
const char *SSL_COMP_get_name(const COMP_METHOD *comp);
STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void);
STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void);
STACK_OF(SSL_COMP) *SSL_COMP_set0_compression_methods(STACK_OF(SSL_COMP) *meths);
STACK_OF(SSL_COMP) *SSL_COMP_set0_compression_methods(STACK_OF(SSL_COMP) *meths);
void SSL_COMP_free_compression_methods(void);
int SSL_COMP_add_compression_method(int id,COMP_METHOD *cm);
int SSL_COMP_add_compression_method(int id,COMP_METHOD *cm);
#else
#else
const void *SSL_get_current_compression(SSL *s);
const void *SSL_get_current_compression(SSL *s);
+12 −0
Original line number Original line Diff line number Diff line
@@ -1899,6 +1899,18 @@ STACK_OF(SSL_COMP) *SSL_COMP_set0_compression_methods(STACK_OF(SSL_COMP) *meths)
	return old_meths;
	return old_meths;
	}
	}


static void cmeth_free(SSL_COMP *cm)
	{
	OPENSSL_free(cm);
	}

void SSL_COMP_free_compression_methods(void)
	{
	STACK_OF(SSL_COMP) *old_meths = ssl_comp_methods;
	ssl_comp_methods = NULL;
	sk_SSL_COMP_pop_free(old_meths, cmeth_free);
	}

int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
	{
	{
	SSL_COMP *comp;
	SSL_COMP *comp;