Mercurial > hg > nnchat
changeset 507:e644d373afb9
Fix a memory leak.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 03 Jun 2012 06:31:52 +0300 |
parents | 8734a02a86ec |
children | f71c59cbc5a7 |
files | ui.c |
diffstat | 1 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ui.c Sat Jun 02 23:33:06 2012 +0300 +++ b/ui.c Sun Jun 03 06:31:52 2012 +0300 @@ -16,13 +16,24 @@ scrWidth, scrHeight; +static void nn_line_free(void *ptr) +{ + nn_line_t *line = (nn_line_t *) ptr; + if (line != NULL) + { + th_free(line->buf); + th_free(line); + } +} + + static nn_window_t *nn_window_new(const char *id) { nn_window_t *res = th_calloc(1, sizeof(nn_window_t)); if (res == NULL) return NULL; - res->data = th_ringbuf_new(NN_BACKBUF_LEN, th_free); + res->data = th_ringbuf_new(NN_BACKBUF_LEN, nn_line_free); if (res->data == NULL) { th_free(res);