diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2018-08-15 09:42:43 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2018-08-15 09:42:43 +0200 |
commit | 6d061a9ac0aa62cb1c86558cc53d8676f9d65ff6 (patch) | |
tree | 6f8a403f8d28c9e93a5b4492d12c18b7041b00a8 /src | |
parent | aff752c50b468d0f641a43d5118b1ca6d42cc73d (diff) | |
download | weechat-6d061a9ac0aa62cb1c86558cc53d8676f9d65ff6.zip |
api: fix memory leak in function string_split
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-string.c | 7 |
1 files changed, 6 insertions, 1 deletions
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; |