Ignore:
Timestamp:
2007-07-02T22:12:03Z (17 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
e900442
Parents:
5d7dc00
Message:

Added (and using) jabber_chat_free() for better memory management, fixed
channel name generation code in root_commands.c and fixed one memory leak
in jabber_buddy_remove_bare().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber_util.c

    r5d7dc00 r9da0bbf  
    542542   specified bare JID. Use this when removing someone from the contact
    543543   list, for example. */
    544 int jabber_buddy_remove_bare( struct im_connection *ic, char *bare_jid_ )
     544int jabber_buddy_remove_bare( struct im_connection *ic, char *bare_jid )
    545545{
    546546        struct jabber_data *jd = ic->proto_data;
    547547        struct jabber_buddy *bud, *next;
    548         char *bare_jid;
    549        
    550         if( strchr( bare_jid_, '/' ) )
     548       
     549        if( strchr( bare_jid, '/' ) )
    551550                return 0;
    552551       
    553         bare_jid = jabber_normalize( bare_jid_ );
    554        
    555         if( ( bud = g_hash_table_lookup( jd->buddies, bare_jid ) ) )
     552        if( ( bud = jabber_buddy_by_jid( ic, bare_jid, GET_BUDDY_FIRST ) ) )
    556553        {
    557554                /* Most important: Remove the hash reference. We don't know
    558555                   this buddy anymore. */
    559556                g_hash_table_remove( jd->buddies, bud->bare_jid );
     557                g_free( bud->bare_jid );
    560558               
    561559                /* Deallocate the linked list of resources. */
    562560                while( bud )
    563561                {
     562                        /* ext_jid && anonymous means that this buddy is
     563                           specific to one groupchat (the one we're
     564                           currently cleaning up) so it can be deleted
     565                           completely. */
     566                        if( bud->ext_jid && bud->flags & JBFLAG_IS_ANONYMOUS )
     567                                imcb_remove_buddy( ic, bud->ext_jid, NULL );
     568                       
    564569                        next = bud->next;
    565570                        g_free( bud->ext_jid );
     
    570575                }
    571576               
    572                 g_free( bare_jid );
    573577                return 1;
    574578        }
    575579        else
    576580        {
    577                 g_free( bare_jid );
    578581                return 0;
    579582        }
Note: See TracChangeset for help on using the changeset viewer.