From: Christian Heller Date: Sun, 3 Aug 2014 02:20:52 +0000 (+0200) Subject: Client: Fix memory leak. X-Git-Tag: tce~675 X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7B%20web_path%20%7D%7D/index.html?a=commitdiff_plain;h=9b7e49d3fb4c1ca2c1d2502a6c3dc3963bd5d6e1;p=plomrogue Client: Fix memory leak. --- 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;