From 213e1ed65afcca71cee412abcc32dcc8a2ca8783 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 16 Mar 2010 17:21:06 -0500 Subject: Fix: Use g_try_malloc instead of g_malloc in util In these cases we were checking for NULL return, but the function used should have been g_try_malloc instead. --- src/util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c index 67d83340..e5ce7b3a 100644 --- a/src/util.c +++ b/src/util.c @@ -588,7 +588,7 @@ char *convert_gsm_to_utf8_with_lang(const unsigned char *text, long len, res_length += UTF8_LENGTH(c); } - res = g_malloc(res_length + 1); + res = g_try_malloc(res_length + 1); if (!res) goto error; @@ -692,7 +692,7 @@ unsigned char *convert_utf8_to_gsm_with_lang(const char *text, long len, nchars += 1; } - res = g_malloc(res_len + (terminator ? 1 : 0)); + res = g_try_malloc(res_len + (terminator ? 1 : 0)); if (!res) goto err_out; @@ -1189,7 +1189,7 @@ char *sim_string_to_utf8(const unsigned char *buffer, int length) if (buffer[i] != 0xff) return NULL; - utf8 = g_malloc(res_len + 1); + utf8 = g_try_malloc(res_len + 1); if (!utf8) return NULL; -- cgit v1.2.3