]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Revert alloc_str changes
authorMartin Willi <martin@revosec.ch>
Thu, 21 Apr 2011 11:21:26 +0000 (13:21 +0200)
committerMartin Willi <martin@revosec.ch>
Thu, 21 Apr 2011 11:35:31 +0000 (13:35 +0200)
This reverts commit fdead26ffe1da8501a6ff5e0639a6f44c723e763.
This reverts commit 3e2419ebe32de72d824864eb2e0e677a7c197af1.
This reverts commit 17ce69b47a1efd6234960cf7d1f50712aee61db5.

17 files changed:
src/libcharon/plugins/eap_gtc/eap_gtc.c
src/libcharon/plugins/eap_peap/eap_peap_server.c
src/libcharon/plugins/eap_radius/eap_radius.c
src/libcharon/plugins/eap_radius/eap_radius_plugin.c
src/libcharon/plugins/eap_radius/radius_server.c
src/libcharon/plugins/eap_radius/radius_socket.c
src/libcharon/plugins/eap_tnc/eap_tnc.c
src/libcharon/plugins/eap_ttls/eap_ttls_server.c
src/libcharon/plugins/load_tester/load_tester_config.c
src/libcharon/plugins/tnc_imc/tnc_imc_manager.c
src/libhydra/plugins/attr/attr_provider.c
src/libhydra/plugins/resolve/resolve_handler.c
src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c
src/libstrongswan/plugins/pkcs11/pkcs11_manager.c
src/libstrongswan/settings.c
src/libstrongswan/settings.h
src/libtls/tls_crypto.c

index 8c5e88c19d2abc211c585f59e5dcb784e4df48c2..c3ab07de061e4c44268c924f1e1a4cc1e4e12f31 100644 (file)
@@ -217,15 +217,13 @@ METHOD(eap_method_t, process_server, status_t,
        memcpy(password, data.ptr, data.len);
        password[data.len] = '\0';
 
-       service = lib->settings->alloc_str(lib->settings,
+       service = lib->settings->get_str(lib->settings,
                                                "charon.plugins.eap-gtc.pam_service", GTC_PAM_SERVICE);
 
        if (!authenticate(service, user, password))
        {
-               free(service);
                return FAILED;
        }
-       free(service);
        return SUCCESS;
 }
 
index e13a6a36c255e03fdaa478cccceda7b8d5a5d0f7..3fabc35751d388c2d518416fbe1312289d9757d4 100644 (file)
@@ -62,17 +62,17 @@ struct private_eap_peap_server_t {
        eap_code_t phase2_result;
 
        /**
-        * Outer phase 1 EAP method
+     * Outer phase 1 EAP method
         */
        eap_method_t *ph1_method;
 
        /**
-        * Current phase 2 EAP method
+     * Current phase 2 EAP method
         */
        eap_method_t *ph2_method;
 
        /**
-        * Pending outbound EAP message
+     * Pending outbound EAP message
         */
        eap_payload_t *out;
 
@@ -90,10 +90,9 @@ static status_t start_phase2_auth(private_eap_peap_server_t *this)
        char *eap_type_str;
        eap_type_t type;
 
-       eap_type_str = lib->settings->alloc_str(lib->settings,
+       eap_type_str = lib->settings->get_str(lib->settings,
                                                "charon.plugins.eap-peap.phase2_method", "mschapv2");
        type = eap_type_from_string(eap_type_str);
-       free(eap_type_str);
        if (type == 0)
        {
                DBG1(DBG_IKE, "unrecognized phase2 method \"%s\"", eap_type_str);
@@ -303,8 +302,8 @@ METHOD(tls_application_t, process, status_t,
                        this->ph2_method->destroy(this->ph2_method);
                        this->ph2_method = NULL;
 
-                       /* EAP-PEAP requires the sending of an inner EAP_SUCCESS message */
-                       this->phase2_result = EAP_SUCCESS;
+                       /* EAP-PEAP requires the sending of an inner EAP_SUCCESS message */     
+                       this->phase2_result = EAP_SUCCESS;              
                        this->out = eap_payload_create_code(this->phase2_result, 1 +
                                                        this->ph1_method->get_identifier(this->ph1_method));
                        return NEED_MORE;
@@ -322,7 +321,7 @@ METHOD(tls_application_t, process, status_t,
                                DBG1(DBG_IKE, "%N method failed", eap_type_names, type);
                        }
                        /* EAP-PEAP requires the sending of an inner EAP_FAILURE message */
-                       this->phase2_result = EAP_FAILURE;
+                       this->phase2_result = EAP_FAILURE;                      
                        this->out = eap_payload_create_code(this->phase2_result, 1 +
                                                        this->ph1_method->get_identifier(this->ph1_method));
                        return NEED_MORE;
@@ -361,7 +360,7 @@ METHOD(tls_application_t, build, status_t,
                this->ph2_method->initiate(this->ph2_method, &this->out);
                this->start_phase2 = FALSE;
        }
-
+       
        this->start_phase2_id = TRUE;
 
        if (this->out)
index 08b46c68cb2fea3e333b96ed3480a45db644bc24..b93a1f5f656fd1311df367de89520645cc7e625b 100644 (file)
@@ -387,7 +387,6 @@ METHOD(eap_method_t, destroy, void,
        this->peer->destroy(this->peer);
        this->server->destroy(this->server);
        this->client->destroy(this->client);
-       free(this->id_prefix);
        free(this);
 }
 
@@ -415,7 +414,7 @@ eap_radius_t *eap_radius_create(identification_t *server, identification_t *peer
                .type = EAP_RADIUS,
                .eap_start = lib->settings->get_bool(lib->settings,
                                                                "charon.plugins.eap-radius.eap_start", FALSE),
-               .id_prefix = lib->settings->alloc_str(lib->settings,
+               .id_prefix = lib->settings->get_str(lib->settings,
                                                                "charon.plugins.eap-radius.id_prefix", ""),
                .class_group = lib->settings->get_bool(lib->settings,
                                                                "charon.plugins.eap-radius.class_group", FALSE),
@@ -426,7 +425,6 @@ eap_radius_t *eap_radius_create(identification_t *server, identification_t *peer
        this->client = radius_client_create();
        if (!this->client)
        {
-               free(this->id_prefix);
                free(this);
                return NULL;
        }
index 8ca5f39566fdf559c6549302e8ed2ba736594cd5..9b1525662783a9888094e4012a8892d24633e55e 100644 (file)
@@ -65,19 +65,18 @@ static void load_servers(private_eap_radius_plugin_t *this)
        char *nas_identifier, *secret, *address, *section;
        int port, sockets, preference;
 
-       address = lib->settings->alloc_str(lib->settings,
+       address = lib->settings->get_str(lib->settings,
                                        "charon.plugins.eap-radius.server", NULL);
        if (address)
        {       /* legacy configuration */
-               secret = lib->settings->alloc_str(lib->settings,
+               secret = lib->settings->get_str(lib->settings,
                                        "charon.plugins.eap-radius.secret", NULL);
                if (!secret)
                {
                        DBG1(DBG_CFG, "no RADUIS secret defined");
-                       free(address);
                        return;
                }
-               nas_identifier = lib->settings->alloc_str(lib->settings,
+               nas_identifier = lib->settings->get_str(lib->settings,
                                        "charon.plugins.eap-radius.nas_identifier", "strongSwan");
                port = lib->settings->get_int(lib->settings,
                                        "charon.plugins.eap-radius.port", RADIUS_PORT);
@@ -85,9 +84,6 @@ static void load_servers(private_eap_radius_plugin_t *this)
                                        "charon.plugins.eap-radius.sockets", 1);
                server = radius_server_create(address, port, nas_identifier,
                                                                          secret, sockets, 0);
-               free(address);
-               free(nas_identifier);
-               free(secret);
                if (!server)
                {
                        DBG1(DBG_CFG, "no RADUIS server defined");
@@ -101,22 +97,21 @@ static void load_servers(private_eap_radius_plugin_t *this)
                                                                                "charon.plugins.eap-radius.servers");
        while (enumerator->enumerate(enumerator, &section))
        {
-               address = lib->settings->alloc_str(lib->settings,
+               address = lib->settings->get_str(lib->settings,
                        "charon.plugins.eap-radius.servers.%s.address", NULL, section);
                if (!address)
                {
                        DBG1(DBG_CFG, "RADIUS server '%s' misses address, skipped", section);
                        continue;
                }
-               secret = lib->settings->alloc_str(lib->settings,
+               secret = lib->settings->get_str(lib->settings,
                        "charon.plugins.eap-radius.servers.%s.secret", NULL, section);
                if (!secret)
                {
                        DBG1(DBG_CFG, "RADIUS server '%s' misses secret, skipped", section);
-                       free(address);
                        continue;
                }
-               nas_identifier = lib->settings->alloc_str(lib->settings,
+               nas_identifier = lib->settings->get_str(lib->settings,
                        "charon.plugins.eap-radius.servers.%s.nas_identifier",
                        "strongSwan", section);
                port = lib->settings->get_int(lib->settings,
@@ -127,9 +122,6 @@ static void load_servers(private_eap_radius_plugin_t *this)
                        "charon.plugins.eap-radius.servers.%s.preference", 0, section);
                server = radius_server_create(address, port, nas_identifier,
                                                                          secret, sockets, preference);
-               free(address);
-               free(nas_identifier);
-               free(secret);
                if (!server)
                {
                        DBG1(DBG_CFG, "loading RADIUS server '%s' failed, skipped", section);
index 7cd1477c3a7310f8760ac862a3397f1178ab786b..37a2d331ecc9036ebc85be9ab1dca383ad35700f 100644 (file)
@@ -201,8 +201,7 @@ radius_server_t *radius_server_create(char *server, u_int16_t port,
                        .destroy = _destroy,
                },
                .reachable = TRUE,
-               .nas_identifier = chunk_clone(chunk_create(nas_identifier,
-                                                                                                  strlen(nas_identifier))),
+               .nas_identifier = chunk_create(nas_identifier, strlen(nas_identifier)),
                .socket_count = sockets,
                .sockets = linked_list_create(),
                .mutex = mutex_create(MUTEX_TYPE_DEFAULT),
index df5f5b08980c8b4f566c2ebc4dd169dce24672f1..76993e75607ccaf57c1f26ed54b87ae4919308db 100644 (file)
@@ -301,7 +301,7 @@ radius_socket_t *radius_socket_create(host_t *host, chunk_t secret)
                destroy(this);
                return NULL;
        }
-       this->secret = chunk_clone(secret);
+       this->secret = secret;
        this->signer->set_key(this->signer, secret);
        /* we use a random identifier, helps if we restart often */
        this->identifier = random();
index 85628340d9ffe80b896ca9cb81c0ca18a7ad8a47..d47fd379e9259cdb38e47535ca59bdf54d7de02d 100644 (file)
@@ -40,7 +40,7 @@ struct private_eap_tnc_t {
 
 
 /** Maximum number of EAP-TNC messages/fragments allowed */
-#define MAX_MESSAGE_COUNT 10
+#define MAX_MESSAGE_COUNT 10 
 /** Default size of a EAP-TNC fragment */
 #define MAX_FRAGMENT_LEN 50000
 
@@ -149,7 +149,7 @@ static eap_tnc_t *eap_tnc_create(identification_t *server,
                                        "charon.plugins.eap-tnc.fragment_size", MAX_FRAGMENT_LEN);
        max_msg_count = lib->settings->get_int(lib->settings,
                                        "charon.plugins.eap-tnc.max_message_count", MAX_MESSAGE_COUNT);
-       protocol = lib->settings->alloc_str(lib->settings,
+       protocol = lib->settings->get_str(lib->settings,
                                        "charon.plugins.eap-tnc.protocol", "tnccs-1.1");
        if (strcaseeq(protocol, "tnccs-2.0"))
        {
@@ -166,11 +166,9 @@ static eap_tnc_t *eap_tnc_create(identification_t *server,
        else
        {
                DBG1(DBG_TNC, "TNCCS protocol '%s' not supported", protocol);
-               free(protocol);
                free(this);
                return NULL;
        }
-       free(protocol);
        tnccs = charon->tnccs->create_instance(charon->tnccs, type, is_server);
        this->tls_eap = tls_eap_create(EAP_TNC, (tls_t*)tnccs, frag_size, max_msg_count);
        if (!this->tls_eap)
index 816710459c912ad7f27576727642dc9bf17e36e6..835cd73065d4aed804407571588861163cab5e72 100644 (file)
@@ -54,12 +54,12 @@ struct private_eap_ttls_server_t {
        bool start_phase2_tnc;
 
        /**
-        * Current phase 2 EAP method
+     * Current phase 2 EAP method
         */
        eap_method_t *method;
 
        /**
-        * Pending outbound EAP message
+     * Pending outbound EAP message
         */
        eap_payload_t *out;
 
@@ -77,10 +77,9 @@ static status_t start_phase2_auth(private_eap_ttls_server_t *this)
        char *eap_type_str;
        eap_type_t type;
 
-       eap_type_str = lib->settings->alloc_str(lib->settings,
+       eap_type_str = lib->settings->get_str(lib->settings,
                                                "charon.plugins.eap-ttls.phase2_method", "md5");
        type = eap_type_from_string(eap_type_str);
-       free(eap_type_str);
        if (type == 0)
        {
                DBG1(DBG_IKE, "unrecognized phase2 method \"%s\"", eap_type_str);
index b522aa7f2e4dd344e796b0827e97e3fc556b026a..71391d593ee07c457bfde2075712863d6a40f2d3 100644 (file)
@@ -279,10 +279,6 @@ static void destroy(private_load_tester_config_t *this)
        this->peer_cfg->destroy(this->peer_cfg);
        DESTROY_IF(this->proposal);
        DESTROY_IF(this->vip);
-       free(this->pool);
-       free(this->remote);
-       free(this->initiator_auth);
-       free(this->responder_auth);
        free(this);
 }
 
@@ -304,9 +300,9 @@ load_tester_config_t *load_tester_config_create()
        {
                this->vip = host_create_from_string("0.0.0.0", 0);
        }
-       this->pool = lib->settings->alloc_str(lib->settings,
+       this->pool = lib->settings->get_str(lib->settings,
                                "charon.plugins.load-tester.pool", NULL);
-       this->remote = lib->settings->alloc_str(lib->settings,
+       this->remote = lib->settings->get_str(lib->settings,
                                "charon.plugins.load-tester.remote", "127.0.0.1");
 
        this->proposal = proposal_create_from_string(PROTO_IKE,
@@ -322,9 +318,9 @@ load_tester_config_t *load_tester_config_create()
        this->child_rekey = lib->settings->get_int(lib->settings,
                                "charon.plugins.load-tester.child_rekey", 600);
 
-       this->initiator_auth = lib->settings->alloc_str(lib->settings,
+       this->initiator_auth = lib->settings->get_str(lib->settings,
                                "charon.plugins.load-tester.initiator_auth", "pubkey");
-       this->responder_auth = lib->settings->alloc_str(lib->settings,
+       this->responder_auth = lib->settings->get_str(lib->settings,
                                "charon.plugins.load-tester.responder_auth", "pubkey");
 
        this->port = lib->settings->get_int(lib->settings,
index a04e495224b093a1ef2fe368735c9f4c76924cf8..aa20534f5d7c721ba1b1cab5cfe8fbb4a79e72d9 100644 (file)
@@ -43,11 +43,6 @@ struct private_tnc_imc_manager_t {
         * Next IMC ID to be assigned
         */
        TNC_IMCID next_imc_id;
-
-       /**
-        * Preferred language
-        */
-       char *preferred_language;
 };
 
 METHOD(imc_manager_t, add, bool,
@@ -100,7 +95,8 @@ METHOD(imc_manager_t, remove_, imc_t*,
 METHOD(imc_manager_t, get_preferred_language, char*,
        private_tnc_imc_manager_t *this)
 {
-       return this->preferred_language;
+       return lib->settings->get_str(lib->settings,
+                                       "charon.plugins.tnc-imc.preferred_language", "en");
 }
 
 METHOD(imc_manager_t, notify_connection_change, void,
@@ -212,7 +208,6 @@ METHOD(imc_manager_t, destroy, void,
                imc->destroy(imc);
        }
        this->imcs->destroy(this->imcs);
-       free(this->preferred_language);
        free(this);
 }
 
@@ -237,8 +232,6 @@ imc_manager_t* tnc_imc_manager_create(void)
                },
                .imcs = linked_list_create(),
                .next_imc_id = 1,
-               .preferred_language = lib->settings->alloc_str(lib->settings,
-                                       "charon.plugins.tnc-imc.preferred_language", "en");
        );
 
        return &this->public;
index 2dd67cb720b51ce3f749be752ebd6dccc996d8b9..44242c259ec1daf7efe3df2fd5b479a9ec34db74 100644 (file)
@@ -109,8 +109,8 @@ static void add_legacy_entry(private_attr_provider_t *this, char *key, int nr,
        host_t *host;
        char *str;
 
-       str = lib->settings->alloc_str(lib->settings, "%s.%s%d", NULL,
-                                                                  hydra->daemon, key, nr);
+       str = lib->settings->get_str(lib->settings, "%s.%s%d", NULL, hydra->daemon,
+                                                                key, nr);
        if (str)
        {
                host = host_create_from_string(str, 0);
@@ -139,7 +139,6 @@ static void add_legacy_entry(private_attr_provider_t *this, char *key, int nr,
                                 configuration_attribute_type_names, entry->type, &entry->value);
                        this->attributes->insert_last(this->attributes, entry);
                }
-               free(str);
        }
 }
 
index d16fec962648c4627b1c1ff22c26636cc1e3bdf3..feb2fd05abd5ff947e4cdd786fcadf3627f21c9c 100644 (file)
@@ -228,7 +228,6 @@ static enumerator_t* create_attribute_enumerator(private_resolve_handler_t *this
 static void destroy(private_resolve_handler_t *this)
 {
        this->mutex->destroy(this->mutex);
-       free(this->file);
        free(this);
 }
 
@@ -245,7 +244,7 @@ resolve_handler_t *resolve_handler_create()
        this->public.destroy = (void(*)(resolve_handler_t*))destroy;
 
        this->mutex = mutex_create(MUTEX_TYPE_DEFAULT);
-       this->file = lib->settings->alloc_str(lib->settings,
+       this->file = lib->settings->get_str(lib->settings,
                                                                "%s.plugins.resolve.file", RESOLV_CONF, hydra->daemon);
 
        return &this->public;
index 39c28d3cd1ab0576e7c7e40b67eadd6f52368036..0b607c3862cfea614d0fddc31502d8f9c9d7d422 100644 (file)
@@ -550,34 +550,36 @@ openssl_rsa_private_key_t *openssl_rsa_private_key_connect(key_type_t type,
 
        if (!engine_id)
        {
-               engine_id = lib->settings->alloc_str(lib->settings,
+               engine_id = lib->settings->get_str(lib->settings,
                                                "libstrongswan.plugins.openssl.engine_id", "pkcs11");
        }
        engine = ENGINE_by_id(engine_id);
        if (!engine)
        {
                DBG2(DBG_LIB, "engine '%s' is not available", engine_id);
-               goto engine_failed;
+               return NULL;
        }
        if (!ENGINE_init(engine))
        {
                DBG1(DBG_LIB, "failed to initialize engine '%s'", engine_id);
-               goto engine_failed;
+               ENGINE_free(engine);
+               return NULL;
        }
        if (!login(engine, keyid))
        {
                DBG1(DBG_LIB, "login to engine '%s' failed", engine_id);
-               goto engine_failed;
+               ENGINE_free(engine);
+               return NULL;
        }
        key = ENGINE_load_private_key(engine, keyname, NULL, NULL);
        if (!key)
        {
                DBG1(DBG_LIB, "failed to load private key with ID '%s' from "
                         "engine '%s'", keyname, engine_id);
-               goto engine_failed;
+               ENGINE_free(engine);
+               return NULL;
        }
        ENGINE_free(engine);
-       free(engine_id);
 
        this = create_empty();
        this->rsa = EVP_PKEY_get1_RSA(key);
@@ -592,12 +594,5 @@ openssl_rsa_private_key_t *openssl_rsa_private_key_connect(key_type_t type,
 #else /* OPENSSL_NO_ENGINE */
        return NULL;
 #endif /* OPENSSL_NO_ENGINE */
-engine_failed:
-       if (engine)
-       {
-               ENGINE_free(engine);
-       }
-       free(engine_id);
-       return NULL;
 }
 
index 7579e0e2edbf714f0a9417b1e1c41cbf0771a337..431cd6a2c9f161204aa2eaa64c3ebd63ade3aaf3 100644 (file)
@@ -74,8 +74,7 @@ static void lib_entry_destroy(lib_entry_t *entry)
        {
                entry->job->cancel(entry->job);
        }
-       DESTROY_IF(entry->lib);
-       free(entry->path);
+       entry->lib->destroy(entry->lib);
        free(entry);
 }
 
@@ -366,12 +365,12 @@ pkcs11_manager_t *pkcs11_manager_create(pkcs11_manager_token_event_t cb,
                        .this = this,
                );
 
-               entry->path = lib->settings->alloc_str(lib->settings,
+               entry->path = lib->settings->get_str(lib->settings,
                                "libstrongswan.plugins.pkcs11.modules.%s.path", NULL, module);
                if (!entry->path)
                {
                        DBG1(DBG_CFG, "PKCS11 module '%s' lacks library path", module);
-                       lib_entry_destroy(entry);
+                       free(entry);
                        continue;
                }
                entry->lib = pkcs11_library_create(module, entry->path,
@@ -380,7 +379,7 @@ pkcs11_manager_t *pkcs11_manager_create(pkcs11_manager_token_event_t cb,
                                                        FALSE, module));
                if (!entry->lib)
                {
-                       lib_entry_destroy(entry);
+                       free(entry);
                        continue;
                }
                this->libs->insert_last(this->libs, entry);
index 941eb0514c570efab2957282788f0a0b46515de8..8a2248b468596c372ba7a8bf8171249a8c5a961b 100644 (file)
@@ -444,21 +444,6 @@ METHOD(settings_t, get_str, char*,
        return def;
 }
 
-METHOD(settings_t, alloc_str, char*,
-       private_settings_t *this, char *key, char *def, ...)
-{
-       char *value;
-       va_list args;
-
-       va_start(args, def);
-       /* additional lock to savely strdup */
-       this->lock->read_lock(this->lock);
-       value = strdupnull(find_value(this, this->top, key, args) ?: def);
-       this->lock->unlock(this->lock);
-       va_end(args);
-       return value;
-}
-
 /**
  * Described in header
  */
@@ -1207,7 +1192,6 @@ settings_t *settings_create(char *file)
        INIT(this,
                .public = {
                        .get_str = _get_str,
-                       .alloc_str = _alloc_str,
                        .get_int = _get_int,
                        .get_double = _get_double,
                        .get_time = _get_time,
index bc106e3a73fbabb02f9e54eaba49b365f12606e4..9ccd02327ab5dbc65da987b4ee569678512ebc90 100644 (file)
@@ -146,31 +146,13 @@ struct settings_t {
        /**
         * Get a settings value as a string.
         *
-        * This functions returns a string held by settings_t. It is not thread
-        * save, a thread calling load_files might free the returned string at
-        * any time. Use the thread save alloc_str if a different thread might
-        * call load_files() or set_str().
-        *
         * @param key           key including sections, printf style format
         * @param def           value returned if key not found
         * @param ...           argument list for key
-        * @return                      value pointing to internal string, not to be freed
+        * @return                      value pointing to internal string
         */
        char* (*get_str)(settings_t *this, char *key, char *def, ...);
 
-       /**
-        * Get a settings value as a string, thread save variant.
-        *
-        * This function is identical to get_str, but is thread save. It allocates
-        * a copy for the returned string which must be freed.
-        *
-        * @param key           key including sections, printf style format
-        * @param def           value returned if key not found
-        * @param ...           argument list for key
-        * @return                      allocated string, to be free
-        */
-       char* (*alloc_str)(settings_t *this, char *key, char *def, ...);
-
        /**
         * Get a boolean yes|no, true|false value.
         *
index fb0373bec487e7a9caf8ce7507e35a835b5d741b..b000f9d47c5f956ac6f631189cbba9481646850a 100644 (file)
@@ -706,7 +706,7 @@ static void filter_key_exchange_config_suites(private_tls_crypto_t *this,
        int i, remaining = 0;
        char *token, *config;
 
-       config = lib->settings->alloc_str(lib->settings, "libtls.key_exchange", NULL);
+       config = lib->settings->get_str(lib->settings, "libtls.key_exchange", NULL);
        if (config)
        {
                for (i = 0; i < *count; i++)
@@ -747,7 +747,6 @@ static void filter_key_exchange_config_suites(private_tls_crypto_t *this,
                        enumerator->destroy(enumerator);
                }
                *count = remaining;
-               free(config);
        }
 }
 
@@ -761,7 +760,7 @@ static void filter_cipher_config_suites(private_tls_crypto_t *this,
        int i, remaining = 0;
        char *token, *config;
 
-       config = lib->settings->alloc_str(lib->settings, "libtls.cipher", NULL);
+       config = lib->settings->get_str(lib->settings, "libtls.cipher", NULL);
        if (config)
        {
                for (i = 0; i < *count; i++)
@@ -813,7 +812,6 @@ static void filter_cipher_config_suites(private_tls_crypto_t *this,
                        enumerator->destroy(enumerator);
                }
                *count = remaining;
-               free(config);
        }
 }
 
@@ -827,7 +825,7 @@ static void filter_mac_config_suites(private_tls_crypto_t *this,
        int i, remaining = 0;
        char *token, *config;
 
-       config = lib->settings->alloc_str(lib->settings, "libtls.mac", NULL);
+       config = lib->settings->get_str(lib->settings, "libtls.mac", NULL);
        if (config)
        {
                for (i = 0; i < *count; i++)
@@ -863,7 +861,6 @@ static void filter_mac_config_suites(private_tls_crypto_t *this,
                        enumerator->destroy(enumerator);
                }
                *count = remaining;
-               free(config);
        }
 }
 
@@ -877,7 +874,7 @@ static void filter_specific_config_suites(private_tls_crypto_t *this,
        int i, remaining = 0, suite;
        char *token, *config;
 
-       config = lib->settings->alloc_str(lib->settings, "libtls.suites", NULL);
+       config = lib->settings->get_str(lib->settings, "libtls.suites", NULL);
        if (config)
        {
                for (i = 0; i < *count; i++)
@@ -895,7 +892,6 @@ static void filter_specific_config_suites(private_tls_crypto_t *this,
                        enumerator->destroy(enumerator);
                }
                *count = remaining;
-               free(config);
        }
 }