Mercurial > ~mikael > mcabber > hg
comparison mcabber/libjabber/jconn.c @ 1125:2ac9bec53c37
Fix a memory leak in libjabber
Fix memory leak, with a better algo to detect if we freed of not the memory.
Reported by valgrind.
author | misc@mandriva.org |
---|---|
date | Sat, 13 Jan 2007 14:36:05 +0100 |
parents | 3fcb7c8af2ba |
children |
comparison
equal
deleted
inserted
replaced
1124:3fcb7c8af2ba | 1125:2ac9bec53c37 |
---|---|
190 * parameters | 190 * parameters |
191 * j -- connection | 191 * j -- connection |
192 */ | 192 */ |
193 void jab_stop(jconn j) | 193 void jab_stop(jconn j) |
194 { | 194 { |
195 if(!j || j->state == JCONN_STATE_OFF) return; | 195 if (!j) return; |
196 | 196 if (j->parser) { |
197 XML_ParserFree(j->parser); | |
198 j->parser = NULL; | |
199 } | |
197 j->state = JCONN_STATE_OFF; | 200 j->state = JCONN_STATE_OFF; |
198 cw_close(j->fd); | 201 if (j->fd >= 0) { |
199 j->fd = -1; | 202 cw_close(j->fd); |
200 XML_ParserFree(j->parser); | 203 j->fd = -1; |
204 } | |
201 } | 205 } |
202 | 206 |
203 /* | 207 /* |
204 * jab_getfd -- get file descriptor of connection socket | 208 * jab_getfd -- get file descriptor of connection socket |
205 * | 209 * |