Commit d7c04b0e authored by Mohammed Sadiq's avatar Mohammed Sadiq
Browse files

matrix: Clear memory before freeing access token

We don't want the access token to stay in memory after the application
is closed
parent 6cfc29da
......@@ -579,7 +579,8 @@ matrix_login_cb (GObject *obj,
api_set_string_value (&self->username, value);
value = matrix_utils_json_object_get_string (root, "access_token");
api_set_string_value (&self->access_token, value);
matrix_utils_free_buffer (self->access_token);
self->access_token = g_strdup (value);
matrix_net_set_access_token (self->matrix_net, self->access_token);
value = matrix_utils_json_object_get_string (root, "device_id");
......@@ -1112,7 +1113,7 @@ matrix_api_set_access_token (MatrixApi *self,
{
g_return_if_fail (MATRIX_IS_API (self));
g_free (self->access_token);
matrix_utils_free_buffer (self->access_token);
g_free (self->device_id);
self->access_token = g_strdup (access_token);
......
......@@ -378,6 +378,7 @@ matrix_net_finalize (GObject *object)
g_clear_object (&self->soup_session);
g_clear_object (&self->file_session);
matrix_utils_free_buffer (self->access_token);
G_OBJECT_CLASS (matrix_net_parent_class)->finalize (object);
}
......@@ -424,7 +425,7 @@ matrix_net_set_access_token (MatrixNet *self,
{
g_return_if_fail (MATRIX_IS_NET (self));
g_free (self->access_token);
matrix_utils_free_buffer (self->access_token);
self->access_token = g_strdup (access_token);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment