]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix memory leaks in 3gpp_pseydonym_encrypt
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 19 Apr 2018 06:52:14 +0000 (18:52 +1200)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 19 Apr 2018 06:53:45 +0000 (18:53 +1200)
Only happened on error but definitely worth addressing

src/modules/rlm_eap/lib/sim/xlat.c

index b02beac92084f02282a6e8031f4694fb114937fe..f607b508637ca531cfac61bcb07bc1aff3ae9d54 100644 (file)
@@ -363,7 +363,7 @@ static ssize_t sim_xlat_3gpp_pseudonym_encrypt(TALLOC_CTX *ctx, char **out, UNUS
        key_len = talloc_array_length(key);
        if (key_len != 16) {
                REDEBUG2("Encryption key incorrect length, expected %i bytes, got %zu bytes", 16, key_len);
-               return -1;
+               goto error;
        }
 
        /*
@@ -372,9 +372,9 @@ static ssize_t sim_xlat_3gpp_pseudonym_encrypt(TALLOC_CTX *ctx, char **out, UNUS
         */
        id_len = talloc_array_length(id) - 1;
        if (id_len != (SIM_IMSI_MAX_LEN + 1)) { /* +1 for ID tag */
-               REDEBUG2("IMSI incorrect length, expected %i bytes, got %zu bytes",
-                        SIM_IMSI_MAX_LEN + 1, id_len);
-               return -1;
+               REDEBUG2("IMSI incorrect length, expected %i bytes, got %zu bytes", SIM_IMSI_MAX_LEN + 1,
+                        id_len);
+               goto error;
        }
 
        if (fr_sim_id_type(&type_hint, &method_hint, id, id_len) < 0) {