From 9b7e49d3fb4c1ca2c1d2502a6c3dc3963bd5d6e1 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sun, 3 Aug 2014 04:20:52 +0200
Subject: [PATCH] Client: Fix memory leak.

---
 TODO                   | 2 --
 src/client/draw_wins.c | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/TODO b/TODO
index e79d141..c37c5c2 100644
--- a/TODO
+++ b/TODO
@@ -12,5 +12,3 @@ BOTH SERVER/CLIENT:
 CLIENT:
 
 - re-work unnecessary complex command / keybinding / server message mapping
-
-- fix memory leakin draw_wins module
diff --git a/src/client/draw_wins.c b/src/client/draw_wins.c
index 6736a1b..67b8cae 100644
--- a/src/client/draw_wins.c
+++ b/src/client/draw_wins.c
@@ -182,7 +182,7 @@ static void add_line_compact(struct Win * win, char * line, attr_t attri,
     uint16_t len_line = strlen(line);
     char * separator = last ? "" : " / ";
     uint32_t len_line_new = len_line + strlen(separator);
-    char * line_new = try_malloc(len_line_new, __func__);
+    char * line_new = try_malloc(len_line_new + 1, __func__);
     int test = sprintf(line_new, "%s%s", line, separator);
     exit_trouble(test < 0, __func__, "sprintf");
     uint16_t x = 0;
-- 
2.30.2