From 33c49321fdcb2a02a8f049fc6edb9f8c057d382f Mon Sep 17 00:00:00 2001 From: mjentsch Date: Mon, 24 Nov 2014 01:35:55 +0100 Subject: [PATCH] Fix potential segfault --- telegram-purple.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/telegram-purple.c b/telegram-purple.c index 6e7646d..53b14b3 100644 --- a/telegram-purple.c +++ b/telegram-purple.c @@ -171,10 +171,12 @@ static char *format_service_msg (struct tgl_state *TLS, struct tgl_message *M) txt_action = NULL; break; } - debug ("SERVICE MESSAGE: %s", txt_action); - txt = g_strdup_printf ("%s %s.", txt_user, txt_action); + if (txt_action) { + debug ("SERVICE MESSAGE: %s", txt_action); + txt = g_strdup_printf ("%s %s.", txt_user, txt_action); + g_free (txt_action); + } g_free (txt_user); - g_free (txt_action); return txt; }