mirror of
https://github.com/weechat/weechat.git
synced 2026-07-07 18:23:13 +02:00
core: fix add of filter on OS X when regex for message is empty (filter regex ending with "\t")
This commit is contained in:
@@ -15,6 +15,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
|
||||
|
||||
== Version 0.4.4 (under dev)
|
||||
|
||||
* core: fix add of filter on OS X when regex for message is empty (filter regex
|
||||
ending with "\t")
|
||||
* core: check validity of buffer pointer when data is sent to a buffer
|
||||
(command/text from user and API function "command")
|
||||
* core: fix crash when buffer is closed during execution of multiple commands
|
||||
|
||||
+18
-11
@@ -284,6 +284,7 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name,
|
||||
|
||||
regex1 = NULL;
|
||||
regex2 = NULL;
|
||||
|
||||
if (strcmp (ptr_start_regex, "*") != 0)
|
||||
{
|
||||
pos_tab = strstr (ptr_start_regex, "\\t");
|
||||
@@ -299,7 +300,7 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name,
|
||||
pos_regex_message = ptr_start_regex;
|
||||
}
|
||||
|
||||
if (regex_prefix)
|
||||
if (regex_prefix && regex_prefix[0])
|
||||
{
|
||||
regex1 = malloc (sizeof (*regex1));
|
||||
if (regex1)
|
||||
@@ -314,18 +315,24 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name,
|
||||
}
|
||||
}
|
||||
|
||||
regex2 = malloc (sizeof (*regex2));
|
||||
if (regex2)
|
||||
if (pos_regex_message && pos_regex_message[0])
|
||||
{
|
||||
if (string_regcomp (regex2, pos_regex_message,
|
||||
REG_EXTENDED | REG_ICASE | REG_NOSUB) != 0)
|
||||
regex2 = malloc (sizeof (*regex2));
|
||||
if (regex2)
|
||||
{
|
||||
if (regex_prefix)
|
||||
free (regex_prefix);
|
||||
if (regex1)
|
||||
free (regex1);
|
||||
free (regex2);
|
||||
return NULL;
|
||||
if (string_regcomp (regex2, pos_regex_message,
|
||||
REG_EXTENDED | REG_ICASE | REG_NOSUB) != 0)
|
||||
{
|
||||
if (regex_prefix)
|
||||
free (regex_prefix);
|
||||
if (regex1)
|
||||
{
|
||||
regfree (regex1);
|
||||
free (regex1);
|
||||
}
|
||||
free (regex2);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user