From: Michael Tremer Date: Fri, 27 Jun 2025 07:19:48 +0000 (+0000) Subject: jwt: Free the decoded payload X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=b933c44971f820379a3d8170cf9003df319ed768;p=pakfire.git jwt: Free the decoded payload Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/jwt.c b/src/pakfire/jwt.c index 4a89fba3..f71d0321 100644 --- a/src/pakfire/jwt.c +++ b/src/pakfire/jwt.c @@ -95,14 +95,18 @@ int pakfire_jwt_payload(const char* token, struct json_object** payload) { // Decode the payload r = pakfire_jwt_decode_payload(&p, &l, token); if (r < 0) - return r; + goto ERROR; // Parse the JSON r = pakfire_json_parse(payload, NULL, p, l); if (r < 0) - return r; + goto ERROR; - return 0; +ERROR: + if (p) + free(p); + + return r; } time_t pakfire_jwt_expires_at(const char* token) {