core: fix memory leak and use of invalid pointer in split of string (in case of insufficient memory)

v2.8-utf8proc
Sebastien Helleu 2014-02-22 12:28:19 +01:00
parent 0110f81e88
commit 9ce8fc7068
2 changed files with 9 additions and 0 deletions

View File

@ -13,6 +13,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
== Version 0.4.4 (under dev)
* core: fix memory leak and use of invalid pointer in split of string (in case
of insufficient memory)
* core: fix potential NULL pointer in function gui_color_emphasize
* core: use same return code and message in all commands when arguments are
wrong/missing

View File

@ -1467,7 +1467,14 @@ string_split_internal (const char *string, const char *separators, int keep_eol,
array = malloc ((n_items + 1) * sizeof (array[0]));
if (!array)
{
free (string2);
return NULL;
}
for (i = 0; i < n_items + 1; i++)
{
array[i] = NULL;
}
ptr1 = string2;