From 6d061a9ac0aa62cb1c86558cc53d8676f9d65ff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Wed, 15 Aug 2018 09:42:43 +0200 Subject: api: fix memory leak in function string_split --- src/core/wee-string.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/wee-string.c b/src/core/wee-string.c index c79a59f43..8770d1eb2 100644 --- a/src/core/wee-string.c +++ b/src/core/wee-string.c @@ -1752,8 +1752,13 @@ string_split_internal (const char *string, const char *separators, int keep_eol, return NULL; string2 = string_strip (string, 1, (keep_eol == 2) ? 0 : 1, separators); - if (!string2 || !string2[0]) + if (!string2) return NULL; + if (!string2[0]) + { + free (string2); + return NULL; + } /* calculate number of items */ ptr = string2; -- cgit v1.2.3