1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-06 01:33:12 +02:00

api: fix memory leak in function string_split

This commit is contained in:
Sébastien Helleu
2018-08-15 09:42:43 +02:00
parent aff752c50b
commit 6d061a9ac0
2 changed files with 7 additions and 1 deletions
+6 -1
View File
@@ -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;