Commit bb90989dbf6077044403da6727831aebe3f6f6bd
1 parent
b5084307
Exists in
master
and in
3 other branches
Fixing memory leaks.
Showing
2 changed files
with
23 additions
and
1 deletions
Show diff stats
src/lib3270/iocalls.c
@@ -204,6 +204,8 @@ static void * internal_add_poll(H3270 *session, int fd, LIB3270_IO_FLAG flag, vo | @@ -204,6 +204,8 @@ static void * internal_add_poll(H3270 *session, int fd, LIB3270_IO_FLAG flag, vo | ||
204 | ip->userdata = userdata; | 204 | ip->userdata = userdata; |
205 | ip->call = call; | 205 | ip->call = call; |
206 | 206 | ||
207 | + ip->next = session->inputs; | ||
208 | + | ||
207 | session->inputs = ip; | 209 | session->inputs = ip; |
208 | session->inputs_changed = 1; | 210 | session->inputs_changed = 1; |
209 | 211 | ||
@@ -565,7 +567,7 @@ static int internal_wait(H3270 *hSession, int seconds) | @@ -565,7 +567,7 @@ static int internal_wait(H3270 *hSession, int seconds) | ||
565 | return 0; | 567 | return 0; |
566 | } | 568 | } |
567 | 569 | ||
568 | -static void internal_ring_bell(H3270 *session) | 570 | +static void internal_ring_bell(H3270 *session unused) |
569 | { | 571 | { |
570 | return; | 572 | return; |
571 | } | 573 | } |
src/lib3270/session.c
@@ -108,6 +108,26 @@ void lib3270_session_free(H3270 *h) | @@ -108,6 +108,26 @@ void lib3270_session_free(H3270 *h) | ||
108 | release_pointer(h->text); | 108 | release_pointer(h->text); |
109 | release_pointer(h->zero_buf); | 109 | release_pointer(h->zero_buf); |
110 | 110 | ||
111 | + release_pointer(h->sbbuf); | ||
112 | + release_pointer(h->tabs); | ||
113 | + | ||
114 | + // Release timeouts | ||
115 | + while(h->timeouts) | ||
116 | + { | ||
117 | + timeout_t *t = h->timeouts; | ||
118 | + h->timeouts = t->next; | ||
119 | + | ||
120 | + lib3270_free(t); | ||
121 | + } | ||
122 | + | ||
123 | + // Release inputs; | ||
124 | + while(h->inputs) | ||
125 | + { | ||
126 | + input_t *ip = h->inputs; | ||
127 | + h->inputs = ip->next; | ||
128 | + lib3270_free(ip); | ||
129 | + } | ||
130 | + | ||
111 | trace("Releasing session %p",h); | 131 | trace("Releasing session %p",h); |
112 | lib3270_free(h); | 132 | lib3270_free(h); |
113 | 133 |