summaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-03-16 17:21:06 -0500
committerDenis Kenzior <denkenz@gmail.com>2010-03-16 17:21:06 -0500
commit213e1ed65afcca71cee412abcc32dcc8a2ca8783 (patch)
tree67a5c9c834ca6ebda3a81f431dda2421046aea7c /src/util.c
parent68b01ce93edc44ba60f97b183424f5d7e23a1cc5 (diff)
downloadofono-213e1ed65afcca71cee412abcc32dcc8a2ca8783.tar.bz2
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.
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c6
1 files changed, 3 insertions, 3 deletions
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;