Fix crash when unloading GData plugin when it's not configured.
authorAndrej Kacian <ticho@claws-mail.org>
Sat, 19 Mar 2016 18:54:40 +0000 (19:54 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Sat, 19 Mar 2016 18:54:40 +0000 (19:54 +0100)
src/plugins/gdata/cm_gdata_contacts.c

index 86fc265..fb75263 100644 (file)
@@ -638,10 +638,12 @@ void cm_gdata_contacts_done(void)
 #if GDATA_CHECK_VERSION(0,17,2)
     /* store refresh token */
     pass = gdata_oauth2_authorizer_dup_refresh_token(authorizer);
 #if GDATA_CHECK_VERSION(0,17,2)
     /* store refresh token */
     pass = gdata_oauth2_authorizer_dup_refresh_token(authorizer);
-               passwd_store_set(PWS_PLUGIN, "GData", GDATA_TOKEN_PWD_STRING, pass,
-                               FALSE);
-    memset(pass, 0, strlen(pass));
-    g_free(pass);
+               if (pass != NULL) {
+                       passwd_store_set(PWS_PLUGIN, "GData", GDATA_TOKEN_PWD_STRING, pass,
+                                       FALSE);
+           memset(pass, 0, strlen(pass));
+           g_free(pass);
+               }
 #endif
 
     g_object_unref(G_OBJECT(authorizer));
 #endif
 
     g_object_unref(G_OBJECT(authorizer));