pidgin/pidgin

3d727b2e6f82
Parents cc08e570d7d5
Children 1e257009ac10
Fix most of libpurple clang scan-build warnings
--- a/libpurple/memorypool.c Thu Apr 03 17:30:00 2014 +0200
+++ b/libpurple/memorypool.c Thu Apr 03 18:01:10 2014 +0200
@@ -128,6 +128,9 @@
blk = purple_memory_pool_block_new(real_size);
g_return_val_if_fail(blk != NULL, NULL);
+ g_assert((priv->first_block == NULL) ==
+ (priv->last_block == NULL));
+
if (priv->first_block == NULL) {
priv->first_block = blk;
priv->last_block = blk;
@@ -160,6 +163,7 @@
blk = priv->first_block;
priv->first_block = NULL;
+ priv->last_block = NULL;
while (blk) {
PurpleMemoryPoolBlock *next = blk->next;
g_free(blk);
--- a/libpurple/protocols/irc/msgs.c Thu Apr 03 17:30:00 2014 +0200
+++ b/libpurple/protocols/irc/msgs.c Thu Apr 03 18:01:10 2014 +0200
@@ -1466,7 +1466,6 @@
PurpleAccount *account = irc->account;
PurpleConnection *gc = purple_account_get_connection(account);
- gboolean plaintext;
gboolean again = FALSE;
/* Set up security properties and options */
@@ -1474,6 +1473,8 @@
secprops.security_flags = SASL_SEC_NOANONYMOUS;
if (!irc->gsc) {
+ gboolean plaintext;
+
secprops.max_ssf = -1;
secprops.maxbufsize = 4096;
plaintext = purple_account_get_bool(account, "auth_plain_in_clear", FALSE);
@@ -1482,7 +1483,6 @@
} else {
secprops.max_ssf = 0;
secprops.maxbufsize = 0;
- plaintext = TRUE;
}
secprops.property_names = 0;
--- a/libpurple/protocols/jabber/caps.c Thu Apr 03 17:30:00 2014 +0200
+++ b/libpurple/protocols/jabber/caps.c Thu Apr 03 18:01:10 2014 +0200
@@ -505,6 +505,13 @@
info = value;
} else {
JabberCapsTuple *n_key = (JabberCapsTuple *)&info->tuple;
+
+ if (G_UNLIKELY(n_key == NULL)) {
+ g_warn_if_reached();
+ jabber_caps_client_info_destroy(info);
+ return;
+ }
+
n_key->node = userdata->node;
n_key->ver = userdata->ver;
n_key->hash = userdata->hash;
--- a/libpurple/protocols/msn/contact.c Thu Apr 03 17:30:00 2014 +0200
+++ b/libpurple/protocols/msn/contact.c Thu Apr 03 18:01:10 2014 +0200
@@ -698,7 +698,6 @@
g_free(mobile_number);
g_free(alias);
passport = Name = uid = type = mobile_number = alias = NULL;
- mobile = FALSE;
if (!(contactId = purple_xmlnode_get_child(contactNode,"contactId"))
|| !(contactInfo = purple_xmlnode_get_child(contactNode, "contactInfo"))
--- a/libpurple/protocols/msn/msn.c Thu Apr 03 17:30:00 2014 +0200
+++ b/libpurple/protocols/msn/msn.c Thu Apr 03 18:01:10 2014 +0200
@@ -2536,7 +2536,10 @@
{
has_info = TRUE;
sect_info = FALSE;
+#if 0
+ /* it's true, but we don't need this assignment */
has_contact_info = TRUE;
+#endif
}
else
{
--- a/libpurple/protocols/msn/p2p.c Thu Apr 03 17:30:00 2014 +0200
+++ b/libpurple/protocols/msn/p2p.c Thu Apr 03 18:01:10 2014 +0200
@@ -161,7 +161,9 @@
if (header->data_header_len > 8) {
header->data_tlv = msn_tlvlist_read(wire, header->data_header_len - 8);
+#if 0
wire += header->data_header_len - 8;
+#endif
}
}
@@ -238,7 +240,9 @@
if (data_header_wire != NULL) {
memcpy(tmp, data_header_wire, header->data_header_len);
+#if 0
tmp += header->data_header_len;
+#endif
}
if (len)
--- a/libpurple/protocols/mxit/chunk.c Thu Apr 03 17:30:00 2014 +0200
+++ b/libpurple/protocols/mxit/chunk.c Thu Apr 03 18:01:10 2014 +0200
@@ -480,6 +480,9 @@
/* mime type [UTF-8] */
pos += get_utf8_string( &chunkdata[pos], offer->mimetype, sizeof( offer->mimetype ) );
+ if (pos > datalen)
+ purple_debug_warning(MXIT_PLUGIN_ID, "pos > datalen");
+
/* timestamp [8 bytes] */
/* not used by libPurple */
@@ -643,6 +646,9 @@
/* status message [UTF-8 string] */
pos += get_utf8_string( &chunkdata[pos], sendfile->statusmsg, sizeof( sendfile->statusmsg ) );
+
+ if (pos != datalen)
+ purple_debug_misc(MXIT_PLUGIN_ID, "pos != datalen");
}
--- a/libpurple/protocols/oscar/family_feedbag.c Thu Apr 03 17:30:00 2014 +0200
+++ b/libpurple/protocols/oscar/family_feedbag.c Thu Apr 03 18:01:10 2014 +0200
@@ -1755,6 +1755,8 @@
/* Unknown */
tmp = byte_stream_get16(bs);
+ if (!tmp)
+ purple_debug_warning("oscar", "unknown field missing");
if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
ret = userfunc(od, conn, frame, bn, msg);
@@ -1846,6 +1848,8 @@
/* Unknown */
tmp = byte_stream_get16(bs);
+ if (!tmp)
+ purple_debug_warning("oscar", "unknown field missing");
if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
ret = userfunc(od, conn, frame, bn, msg);
@@ -1950,6 +1954,8 @@
/* Unknown */
tmp = byte_stream_get16(bs);
+ if (!tmp)
+ purple_debug_warning("oscar", "unknown field missing");
if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
ret = userfunc(od, conn, frame, bn, reply, msg);
--- a/libpurple/protocols/yahoo/yahoo_profile.c Thu Apr 03 17:30:00 2014 +0200
+++ b/libpurple/protocols/yahoo/yahoo_profile.c Thu Apr 03 18:01:10 2014 +0200
@@ -978,6 +978,8 @@
/* in to purple_markup_strip_html*/
char *fudged_buffer;
+ g_return_if_fail(strings != NULL);
+
yd = purple_connection_get_protocol_data(info_data->gc);
fudged_buffer = purple_strcasereplace(url_buffer, "</dd>", "</dd><br>");
@@ -989,7 +991,7 @@
purple_debug_misc("yahoo", "url_buffer = %p\n", url_buffer);
/* convert to utf8 */
- if (strings && strings->charset) {
+ if (strings->charset) {
p = g_convert(stripped, -1, "utf-8", strings->charset,
NULL, NULL, NULL);
if (!p) {
@@ -1009,7 +1011,7 @@
p = NULL;
/* "Last updated" should also be converted to utf8 and with &nbsp; killed */
- if (strings && strings->charset) {
+ if (strings->charset) {
last_updated_utf8_string = g_convert(last_updated_string, -1, "utf-8",
strings->charset, NULL, NULL, NULL);
yahoo_remove_nonbreaking_spaces(last_updated_utf8_string);