improved fix
authorAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 12 Nov 2008 04:08:30 +0000 (04:08 -0000)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 12 Nov 2008 04:08:30 +0000 (04:08 -0000)
src/charon/config/proposal.c

index 7c07523..1421d5e 100644 (file)
@@ -210,17 +210,21 @@ static bool get_algorithm(private_proposal_t *this, transform_type_t type,
                                                  u_int16_t *alg, u_int16_t *key_size)
 {
        enumerator_t *enumerator;
-       bool found = FALSE;
+       bool found;
        
-       if (key_size)
-       {
-               *key_size = 0; /* Just in case no algorithm is found */
-       }
        enumerator = create_enumerator(this, type);
        if (enumerator->enumerate(enumerator, alg, key_size))
        {
                found = TRUE;
        }
+       else
+       {
+               if (key_size)
+               {
+                       *key_size = 0;
+               }
+               found = FALSE;
+       }
        enumerator->destroy(enumerator);
        return found;
 }