# HG changeset patch # User Matti Hamalainen # Date 1338694312 -10800 # Node ID e644d373afb9c5b3c1b3d8fc9409b9f89e0ef3c6 # Parent 8734a02a86ecf98b5d11c4a8d738dbbb1ef26bb0 Fix a memory leak. diff -r 8734a02a86ec -r e644d373afb9 ui.c --- 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);