From: Arran Cudbard-Bell Date: Thu, 19 Apr 2018 06:52:14 +0000 (+1200) Subject: Fix memory leaks in 3gpp_pseydonym_encrypt X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7fb9847dfa8de711067d96d7ef09015724a13b2e;p=thirdparty%2Ffreeradius-server.git Fix memory leaks in 3gpp_pseydonym_encrypt Only happened on error but definitely worth addressing --- diff --git a/src/modules/rlm_eap/lib/sim/xlat.c b/src/modules/rlm_eap/lib/sim/xlat.c index b02beac9208..f607b508637 100644 --- a/src/modules/rlm_eap/lib/sim/xlat.c +++ b/src/modules/rlm_eap/lib/sim/xlat.c @@ -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) {