core: fix memory leak and use of invalid pointer in split of string (in case of insufficient memory)
This commit is contained in:
parent
0110f81e88
commit
9ce8fc7068
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user