summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2013-12-15 19:50:56 +0100
committerSebastien Helleu <flashcode@flashtux.org>2013-12-15 19:50:56 +0100
commit2f3d712a62e319fc34b276ed504e50d068ca7b0d (patch)
tree34ada538879e433f3a24ac9751345f1924b13f11 /src
parent4c3d090184e12b5379d7300689b0322f65905c8a (diff)
downloadweechat-2f3d712a62e319fc34b276ed504e50d068ca7b0d.zip
core: fix use of NULL pointer (in case of malloc error) when creating a new filter
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui-filter.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/gui-filter.c b/src/gui/gui-filter.c
index f912369d9..979ad7c8e 100644
--- a/src/gui/gui-filter.c
+++ b/src/gui/gui-filter.c
@@ -355,11 +355,14 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name,
{
new_filter->tags_array = malloc (new_filter->tags_count *
sizeof (*new_filter->tags_array));
- for (i = 0; i < new_filter->tags_count; i++)
+ if (new_filter->tags_array)
{
- new_filter->tags_array[i] = string_split (tags_array[i],
- "+", 0, 0,
- NULL);
+ for (i = 0; i < new_filter->tags_count; i++)
+ {
+ new_filter->tags_array[i] = string_split (tags_array[i],
+ "+", 0, 0,
+ NULL);
+ }
}
string_free_split (tags_array);
}