From 7865557fd56f7934d6ec2eafb2b5ade5ccf510d6 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Tue, 10 Nov 2015 10:54:17 -0500 Subject: [PATCH] core/string: Realloc strings before returning g_strchomp() modifies the string in place, but doesn't free up unused memory at the end of the original string. Signed-off-by: Anna Schumaker --- core/string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/string.c b/core/string.c index 5b7c22e7..d159ea66 100644 --- a/core/string.c +++ b/core/string.c @@ -73,7 +73,7 @@ gchar *string_lowercase(const gchar *str) *j = '\0'; g_strchomp(res); - return res; + return g_realloc(res, strlen(res) + 1); } int string_compare(const gchar *lhs, const gchar *rhs)