changeset 1546:c4ed9e145279

Fix uninitialized pointer (reported by T. Glaser)
author Mikael Berthe <mikael@lilotux.net>
date Sun, 05 Oct 2008 23:39:26 +0200
parents 31472d421267
children 922e454a8187
files mcabber/src/jabglue.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/jabglue.c	Sun Oct 05 23:34:39 2008 +0200
+++ b/mcabber/src/jabglue.c	Sun Oct 05 23:39:26 2008 +0200
@@ -2600,7 +2600,7 @@
       subject = p;
     } else {                                      // Room topic
       GSList *roombuddy;
-      gchar *mbuf;
+      gchar *mbuf = NULL;
       gchar *subj = p;
 
       // In a groupchat message, the subject can be NULL when
@@ -2628,12 +2628,14 @@
         else
           mbuf = g_strdup_printf("%s has cleared the topic", r);
       }
-      scr_WriteIncomingMessage(s, mbuf, 0,
-                               HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG, 0);
-      if (settings_opt_get_int("log_muc_conf"))
-        hlog_write_message(s, 0, -1, mbuf);
+      if (mbuf) {
+        scr_WriteIncomingMessage(s, mbuf, 0,
+                                 HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG, 0);
+        if (settings_opt_get_int("log_muc_conf"))
+          hlog_write_message(s, 0, -1, mbuf);
+        g_free(mbuf);
+      }
       g_free(s);
-      g_free(mbuf);
       // The topic is displayed in the chat status line, so refresh now.
       scr_UpdateChatStatus(TRUE);
     }