pidgin/pidgin

Add NULL checks

16 months ago, qarkai
13cfb1168f42
Parents 9fc7c3c226d8
Children 0ce616f8d0ec
Add NULL checks
--- a/libpurple/protocols/jabber/buddy.c Mon Nov 04 01:02:13 2019 +0300
+++ b/libpurple/protocols/jabber/buddy.c Mon Nov 04 01:03:02 2019 +0300
@@ -58,8 +58,11 @@
gchar *last_message;
} JabberBuddyInfo;
-void jabber_adhoc_commands_free(JabberAdHocCommands *cmd)
+void
+jabber_adhoc_commands_free(JabberAdHocCommands *cmd)
{
+ g_return_if_fail(cmd != NULL);
+
g_free(cmd->jid);
g_free(cmd->node);
g_free(cmd->name);
--- a/libpurple/protocols/jabber/jabber.c Mon Nov 04 01:02:13 2019 +0300
+++ b/libpurple/protocols/jabber/jabber.c Mon Nov 04 01:03:02 2019 +0300
@@ -2005,6 +2005,8 @@
}
static void jabber_feature_free(JabberFeature *feature) {
+ g_return_if_fail(feature != NULL);
+
g_free(feature->namespace);
g_free(feature);
}
@@ -2058,6 +2060,8 @@
void jabber_identity_free(JabberIdentity *id)
{
+ g_return_if_fail(id != NULL);
+
g_free(id->category);
g_free(id->type);
g_free(id->lang);
@@ -2090,8 +2094,7 @@
void jabber_bytestreams_streamhost_free(JabberBytestreamsStreamhost *sh)
{
- if(!sh)
- return;
+ g_return_if_fail(sh != NULL);
g_free(sh->jid);
g_free(sh->host);
--- a/libpurple/protocols/novell/nmrtf.c Mon Nov 04 01:02:13 2019 +0300
+++ b/libpurple/protocols/novell/nmrtf.c Mon Nov 04 01:03:02 2019 +0300
@@ -242,6 +242,8 @@
static void
nm_rtf_font_free(NMRtfFont *font)
{
+ g_return_if_fail(font != NULL);
+
g_free(font->name);
g_free(font);
}
--- a/libpurple/stringref.c Mon Nov 04 01:02:13 2019 +0300
+++ b/libpurple/stringref.c Mon Nov 04 01:03:02 2019 +0300
@@ -147,6 +147,8 @@
static void stringref_free(PurpleStringref *stringref)
{
+ g_return_if_fail(stringref != NULL);
+
if (REFCOUNT(stringref->ref) == 0) {
g_free(stringref);
return;
--- a/libpurple/util.c Mon Nov 04 01:02:13 2019 +0300
+++ b/libpurple/util.c Mon Nov 04 01:03:02 2019 +0300
@@ -4254,6 +4254,8 @@
void purple_key_value_pair_free(PurpleKeyValuePair *kvp)
{
+ g_return_if_fail(kvp != NULL);
+
g_free(kvp->value);
g_free(kvp->key);
g_free(kvp);
--- a/pidgin/gtkaccount.c Mon Nov 04 01:02:13 2019 +0300
+++ b/pidgin/gtkaccount.c Mon Nov 04 01:03:02 2019 +0300
@@ -775,6 +775,8 @@
static void
protocol_opt_entry_free(ProtocolOptEntry *opt_entry)
{
+ g_return_if_fail(opt_entry != NULL);
+
g_free(opt_entry->setting);
g_free(opt_entry);
}
--- a/pidgin/gtkblist.c Mon Nov 04 01:02:13 2019 +0300
+++ b/pidgin/gtkblist.c Mon Nov 04 01:03:02 2019 +0300
@@ -3063,6 +3063,8 @@
static void
tooltip_data_free(struct tooltip_data *td)
{
+ g_return_if_fail(td != NULL);
+
g_clear_object(&td->avatar);
g_clear_object(&td->status_icon);
g_clear_object(&td->protocol_icon);
--- a/pidgin/gtksmiley-theme.c Mon Nov 04 01:02:13 2019 +0300
+++ b/pidgin/gtksmiley-theme.c Mon Nov 04 01:03:02 2019 +0300
@@ -93,6 +93,8 @@
static void
pidgin_smiley_theme_index_smiley_free(PidginSmileyThemeIndexSmiley *smiley)
{
+ g_return_if_fail(smiley != NULL);
+
g_free(smiley->file);
g_list_free_full(smiley->shortcuts, g_free);
g_free(smiley);
@@ -101,6 +103,8 @@
static void
pidgin_smiley_theme_index_protocol_free(PidginSmileyThemeIndexProtocol *proto)
{
+ g_return_if_fail(proto != NULL);
+
g_free(proto->name);
g_list_free_full(proto->smileys, (GDestroyNotify)pidgin_smiley_theme_index_smiley_free);
g_free(proto);
--- a/pidgin/plugins/ticker/ticker.c Mon Nov 04 01:02:13 2019 +0300
+++ b/pidgin/plugins/ticker/ticker.c Mon Nov 04 01:03:02 2019 +0300
@@ -189,6 +189,8 @@
}
static void ticker_data_free(TickerData *td) {
+ g_return_if_fail(td != NULL);
+
if (td->timeout != 0)
g_source_remove(td->timeout);
g_free(td);