[telepathy-salut-0.8] telepathy-salut: tubes: don' t use an uninitialized tube_id.
Will Thompson
wjt at kemper.freedesktop.org
Fri Nov 16 06:05:13 PST 2012
Module: telepathy-salut
Branch: telepathy-salut-0.8
Commit: 6199eab3f074c3159b31389a37e432bf9f69cd76
URL: http://cgit.freedesktop.org/telepathy/telepathy-salut/commit/?id=6199eab3f074c3159b31389a37e432bf9f69cd76
Author: Will Thompson <will.thompson at collabora.co.uk>
Date: Mon Jul 2 15:19:21 2012 +0100
tubes: don't use an uninitialized tube_id.
gcc rightly points out that tube_id may be uninitialized if
extract_tube_information() returns false.
---
src/tubes-channel.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/tubes-channel.c b/src/tubes-channel.c
index c847208..289eb3b 100644
--- a/src/tubes-channel.c
+++ b/src/tubes-channel.c
@@ -653,14 +653,19 @@ salut_tubes_channel_muc_message_received (SalutTubesChannel *self,
{
WockyNode *tube_node = (WockyNode *) l->data;
const gchar *stream_id;
- SalutTubeIface *tube;
+ SalutTubeIface *tube = NULL;
guint tube_id;
TpTubeType type;
stream_id = wocky_node_get_attribute (tube_node, "stream-id");
- extract_tube_information (self, tube_node, NULL,
- NULL, NULL, NULL, &tube_id);
+ if (!extract_tube_information (self, tube_node, NULL,
+ NULL, NULL, NULL, &tube_id))
+ {
+ DEBUG ("can't find a tube ID; never mind then.");
+ continue;
+ }
+
tube = g_hash_table_lookup (priv->tubes, GUINT_TO_POINTER (tube_id));
if (tube == NULL)
More information about the telepathy-commits
mailing list