Changeset 1e52e1f for query.c


Ignore:
Timestamp:
2010-07-11T10:30:27Z (11 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
af9f2ca
Parents:
e92c4f4
Message:

When cleaning up queries, q->data is free()d. Even if it turns out to be
the "struct irc" containing all data belonging to a session. Sanitise
memory management a little bit here. (There are some memory leaks in here
too that need to be fixed at some point.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • query.c

    re92c4f4 r1e52e1f  
    3131
    3232query_t *query_add( irc_t *irc, struct im_connection *ic, char *question,
    33                     query_callback yes, query_callback no, void *data )
     33                    query_callback yes, query_callback no, query_callback free,
     34                    void *data )
    3435{
    3536        query_t *q = g_new0( query_t, 1 );
     
    3940        q->yes = yes;
    4041        q->no = no;
     42        q->free = free;
    4143        q->data = data;
    4244       
     
    9496       
    9597        g_free( q->question );
    96         if( q->data ) g_free( q->data ); /* Memory leak... */
     98        if( q->free && q->data )
     99                q->free( q->data );
    97100        g_free( q );
    98101}
Note: See TracChangeset for help on using the changeset viewer.