summaryrefslogtreecommitdiffstats
path: root/gatchat/gatutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'gatchat/gatutil.c')
-rw-r--r--gatchat/gatutil.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gatchat/gatutil.c b/gatchat/gatutil.c
index 7ca1d3f9..575019d6 100644
--- a/gatchat/gatutil.c
+++ b/gatchat/gatutil.c
@@ -60,7 +60,10 @@ void g_at_util_debug_chat(gboolean in, const char *str, gsize len,
escaped += 4;
}
- escaped_str = g_malloc(escaped + 1);
+ escaped_str = g_try_malloc(escaped + 1);
+ if (escaped_str == NULL)
+ return;
+
escaped_str[0] = type;
escaped_str[1] = ' ';
escaped_str[2] = '\0';