talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 4d7fede4294566578f3c4cb9e949e744d140055a
parent 3ac411c860cb9e2cbda08cec6aa59a44051837dc
Author: wwp <subscript@free.fr>
Date:   Mon,  4 Oct 2021 00:33:51 +0200

Fix (or better fix for) CID 1491155, 1491195 and 1491351: resource leaks.

Diffstat:
Msrc/oauth2.c | 11+++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/oauth2.c b/src/oauth2.c @@ -215,7 +215,7 @@ int oauth2_obtain_tokens (Oauth2Service provider, OAUTH2Data *OAUTH2Data, const gchar *request; gchar *response; gchar *body; - gchar *uri; + gchar *uri, *uri2; gchar *header; gchar *tmp_hd, *tmp_hd_encoded; gchar *access_token; @@ -260,7 +260,6 @@ int oauth2_obtain_tokens (Oauth2Service provider, OAUTH2Data *OAUTH2Data, const access_token = g_malloc(OAUTH2BUFSIZE+1); request = g_malloc(OAUTH2BUFSIZE+1); response = g_malloc(OAUTH2BUFSIZE+1); - body = g_malloc(OAUTH2BUFSIZE+1); if(OAUTH2Data->custom_client_id) client_id = g_strdup(OAUTH2Data->custom_client_id); @@ -268,8 +267,9 @@ int oauth2_obtain_tokens (Oauth2Service provider, OAUTH2Data *OAUTH2Data, const client_id = oauth2_decode(OAUTH2info[i][OA2_CLIENT_ID]); uri = g_uri_escape_string (client_id, NULL, FALSE); - body = g_strconcat ("client_id=", uri, - "&code=",g_uri_escape_string (token, NULL, FALSE), NULL); + uri2 = g_uri_escape_string (token, NULL, FALSE); + body = g_strconcat ("client_id=", uri, "&code=", uri2, NULL); + g_free(uri2); g_free(uri); g_free(token); @@ -408,7 +408,6 @@ gint oauth2_use_refresh_token (Oauth2Service provider, OAUTH2Data *OAUTH2Data) access_token = g_malloc(OAUTH2BUFSIZE+1); request = g_malloc(OAUTH2BUFSIZE+1); response = g_malloc(OAUTH2BUFSIZE+1); - body = g_malloc(OAUTH2BUFSIZE+1); if(OAUTH2Data->custom_client_id) client_id = g_strdup(OAUTH2Data->custom_client_id); @@ -416,7 +415,7 @@ gint oauth2_use_refresh_token (Oauth2Service provider, OAUTH2Data *OAUTH2Data) client_id = oauth2_decode(OAUTH2info[i][OA2_CLIENT_ID]); uri = g_uri_escape_string (client_id, NULL, FALSE); - body = g_strconcat ("client_id=", uri, "&refresh_token=",OAUTH2Data->refresh_token, NULL); + body = g_strconcat ("client_id=", uri, "&refresh_token=", OAUTH2Data->refresh_token, NULL); g_free(uri); if(OAUTH2info[i][OA2_CLIENT_SECRET][0]){