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
This commit is contained in:
parent
70d110026c
commit
f15ea72da3
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user