changeset 24314:6757bffb3d3a

Fix a potential leak, thanks to "KuSh". Fixes #7464.
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 07 Nov 2008 02:52:31 +0000
parents b4964c3f5f7c
children dd787f8d5e91
files libpurple/protocols/sametime/sametime.c
diffstat 1 files changed, 7 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/sametime/sametime.c	Fri Nov 07 02:49:23 2008 +0000
+++ b/libpurple/protocols/sametime/sametime.c	Fri Nov 07 02:52:31 2008 +0000
@@ -4490,27 +4490,25 @@
 			      PurpleBuddy *buddy,
 			      PurpleGroup *group) {
 
-  struct mwPurplePluginData *pd;
+  struct mwPurplePluginData *pd = gc->proto_data;
   struct mwServiceResolve *srvc;
   GList *query;
   enum mwResolveFlag flags;
   guint32 req;
-
   BuddyAddData *data;
 
-  data = g_new0(BuddyAddData, 1);
-  data->buddy = buddy;
-  data->group = group;
-
-  pd = gc->proto_data;
-  srvc = pd->srvc_resolve;
-
   /* catch external buddies. They won't be in the resolve service */
   if(buddy_is_external(buddy)) {
     buddy_add(pd, buddy);
     return;
   }
 
+  data = g_new0(BuddyAddData, 1);
+  data->buddy = buddy;
+  data->group = group;
+
+  srvc = pd->srvc_resolve;
+
   query = g_list_prepend(NULL, buddy->name);
   flags = mwResolveFlag_FIRST | mwResolveFlag_USERS;