[Commits] [SCM] claws branch, master, updated. 3.18.0-230-g4d7fede42

wwp at claws-mail.org wwp at claws-mail.org
Mon Oct 4 00:34:40 CEST 2021


The branch, master has been updated
       via  4d7fede4294566578f3c4cb9e949e744d140055a (commit)
      from  3ac411c860cb9e2cbda08cec6aa59a44051837dc (commit)

Summary of changes:
 src/oauth2.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)


- Log -----------------------------------------------------------------
commit 4d7fede4294566578f3c4cb9e949e744d140055a
Author: wwp <subscript at free.fr>
Date:   Mon Oct 4 00:33:51 2021 +0200

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

diff --git a/src/oauth2.c b/src/oauth2.c
index 3e8195a7a..626666889 100644
--- 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]){

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list