summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2017-03-25 14:05:55 +0100
committerSébastien Helleu <flashcode@flashtux.org>2017-03-25 14:05:55 +0100
commitf15ea72da3891de90e3f634202a6ca0faa00088a (patch)
treebb06329e3f2c84fb0f85dca07f43fbcfd1cfc0f3
parent70d110026cd9dda4fa7ce570550d7931f234120e (diff)
downloadweechat-f15ea72da3891de90e3f634202a6ca0faa00088a.zip
irc: check that pointers received in arguments are not NULL in "free" functions
Functions: - irc_channel_nick_speaking_time_free - irc_ignore_free - irc_notify_free - irc_raw_message_free - irc_server_outqueue_free
-rw-r--r--src/plugins/irc/irc-channel.c3
-rw-r--r--src/plugins/irc/irc-ignore.c3
-rw-r--r--src/plugins/irc/irc-notify.c3
-rw-r--r--src/plugins/irc/irc-raw.c3
-rw-r--r--src/plugins/irc/irc-server.c3
5 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index 80674dec4..4a133d8f2 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -891,6 +891,9 @@ void
irc_channel_nick_speaking_time_free (struct t_irc_channel *channel,
struct t_irc_channel_speaking *nick_speaking)
{
+ if (!channel || !nick_speaking)
+ return;
+
/* free data */
if (nick_speaking->nick)
free (nick_speaking->nick);
diff --git a/src/plugins/irc/irc-ignore.c b/src/plugins/irc/irc-ignore.c
index 5ebc0a941..884a81fea 100644
--- a/src/plugins/irc/irc-ignore.c
+++ b/src/plugins/irc/irc-ignore.c
@@ -251,6 +251,9 @@ irc_ignore_free (struct t_irc_ignore *ignore)
{
struct t_irc_ignore *ptr_ignore;
+ if (!ignore)
+ return;
+
(void) weechat_hook_signal_send ("irc_ignore_removing",
WEECHAT_HOOK_SIGNAL_POINTER, ignore);
diff --git a/src/plugins/irc/irc-notify.c b/src/plugins/irc/irc-notify.c
index 74a542e3d..93d2b4b8f 100644
--- a/src/plugins/irc/irc-notify.c
+++ b/src/plugins/irc/irc-notify.c
@@ -434,6 +434,9 @@ void
irc_notify_free (struct t_irc_server *server, struct t_irc_notify *notify,
int remove_monitor)
{
+ if (!server || !notify)
+ return;
+
(void) weechat_hook_signal_send ("irc_notify_removing",
WEECHAT_HOOK_SIGNAL_POINTER, notify);
diff --git a/src/plugins/irc/irc-raw.c b/src/plugins/irc/irc-raw.c
index c10456c21..62c38c924 100644
--- a/src/plugins/irc/irc-raw.c
+++ b/src/plugins/irc/irc-raw.c
@@ -119,6 +119,9 @@ irc_raw_message_free (struct t_irc_raw_message *raw_message)
{
struct t_irc_raw_message *new_raw_messages;
+ if (!raw_message)
+ return;
+
/* remove message from raw messages list */
if (last_irc_raw_message == raw_message)
last_irc_raw_message = raw_message->prev_message;
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 569888f36..2645c6c52 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -1512,6 +1512,9 @@ irc_server_outqueue_free (struct t_irc_server *server,
{
struct t_irc_outqueue *new_outqueue;
+ if (!server || !outqueue)
+ return;
+
/* remove outqueue message */
if (server->last_outqueue[priority] == outqueue)
server->last_outqueue[priority] = outqueue->prev_outqueue;