[PATCH] Fix: Invalid free of constant string

0 views
Skip to first unread message

Adrian Perez

unread,
Jun 15, 2009, 7:40:02 PM6/15/09
to frogr...@googlegroups.com
Getter methods of FrogrAccount do not return string copies, so there is no
need to free them. This particular case provoked the token in the
configuration file not to be saved correctly so it could not be reused.
---
src/frogr-facade.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/frogr-facade.c b/src/frogr-facade.c
index 232beae..7ba13bf 100644
--- a/src/frogr-facade.c
+++ b/src/frogr-facade.c
@@ -76,7 +76,7 @@ frogr_facade_init (FrogrFacade *ffacade)
{
FrogrFacadePrivate *priv = FROGR_FACADE_GET_PRIVATE (ffacade);
FrogrAccount *faccount;
- gchar *token;
+ const gchar *token;

/* Get config */
priv -> config = frogr_config_get_instance ();
@@ -94,11 +94,10 @@ frogr_facade_init (FrogrFacade *ffacade)

/* If available, set token */
faccount = frogr_config_get_default_account (priv -> config);
- token = (gchar *)frogr_account_get_token (faccount);
+ token = frogr_account_get_token (faccount);
if (token != NULL)
{
flickcurl_set_auth_token (priv->fcurl, token);
- g_free (token);
}
}

--
1.6.3.2

Mario Sanchez Prada

unread,
Jun 16, 2009, 2:49:45 AM6/16/09
to frogr...@googlegroups.com
Yes
Reply all
Reply to author
Forward
0 new messages