From 1eb51a18ec06b3c8add77d876af0f5a599279c67 Mon Sep 17 00:00:00 2001 From: Ben Foster Date: Wed, 25 Oct 2017 23:53:07 +0100 Subject: Free additionally allocated `sp_list` instances References #43. --- src/snuffleupagus.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/snuffleupagus.c') diff --git a/src/snuffleupagus.c b/src/snuffleupagus.c index 2cc31d8..7db6c93 100644 --- a/src/snuffleupagus.c +++ b/src/snuffleupagus.c @@ -3,6 +3,7 @@ #endif #include "php_snuffleupagus.h" +#include "sp_config.h" #ifndef ZEND_EXT_API #define ZEND_EXT_API ZEND_DLEXPORT @@ -118,11 +119,20 @@ PHP_MSHUTDOWN_FUNCTION(snuffleupagus) { pefree(SNUFFLEUPAGUS_G(config.config_upload_validation), 1); pefree(SNUFFLEUPAGUS_G(config.config_cookie_encryption), 1); - sp_list_free(SNUFFLEUPAGUS_G(config.config_disabled_functions->disabled_functions)); + sp_node_t* disabled_functions = SNUFFLEUPAGUS_G(config.config_disabled_functions->disabled_functions); + sp_node_t* disabled_functions_ret = SNUFFLEUPAGUS_G(config.config_disabled_functions_ret->disabled_functions); + sp_node_t* disabled_constructs = SNUFFLEUPAGUS_G(config.config_disabled_constructs->construct_include); + + // Free the list of disabled functions for each `sp_disabled_function` instance + sp_disabled_function_list_free(disabled_functions); + sp_disabled_function_list_free(disabled_functions_ret); + sp_disabled_function_list_free(disabled_constructs); + + sp_list_free(disabled_functions); pefree(SNUFFLEUPAGUS_G(config.config_disabled_functions), 1); - sp_list_free(SNUFFLEUPAGUS_G(config.config_disabled_functions_ret->disabled_functions)); + sp_list_free(disabled_functions_ret); pefree(SNUFFLEUPAGUS_G(config.config_disabled_functions_ret), 1); - sp_list_free(SNUFFLEUPAGUS_G(config.config_disabled_constructs->construct_include)); + sp_list_free(disabled_constructs); pefree(SNUFFLEUPAGUS_G(config.config_disabled_constructs), 1); UNREGISTER_INI_ENTRIES(); -- cgit v1.3