changeset 24857:4455637864b4

Fix a potential leak "KuSh" discovered using "cppcheck". Fixes #7862.
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 22 Dec 2008 16:15:40 +0000
parents 75690a3eeee0
children 09521734fe40
files libpurple/protocols/sametime/sametime.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/sametime/sametime.c	Mon Dec 22 16:13:43 2008 +0000
+++ b/libpurple/protocols/sametime/sametime.c	Mon Dec 22 16:15:40 2008 +0000
@@ -3724,7 +3724,6 @@
   gc->flags |= PURPLE_CONNECTION_NO_IMAGES;
 
   user = g_strdup(purple_account_get_username(account));
-  pass = g_strdup(purple_account_get_password(account));
 
   host = strrchr(user, ':');
   if(host) {
@@ -3741,10 +3740,12 @@
   if(! host || ! *host) {
     /* somehow, we don't have a host to connect to. Well, we need one
        to actually continue, so let's ask the user directly. */
+    g_free(user);
     prompt_host(gc);
     return;
   }
 
+  pass = g_strdup(purple_account_get_password(account));
   port = purple_account_get_int(account, MW_KEY_PORT, MW_PLUGIN_DEFAULT_PORT);
 
   DEBUG_INFO("user: '%s'\n", user);