bug fix for that VCONFKEY_TELEPHONY_PLMN is always 0 - add plmn_id copy in on_respons...
[platform/core/telephony/tel-plugin-imc.git] / src / s_common.c
index 50ee24e..430aa2f 100644 (file)
@@ -110,13 +110,13 @@ char* util_hexStringToBytes(char *s)
 
        sz = strlen(s);
 
-       ret = calloc((sz / 2) + 1, 1);
+       ret = g_try_malloc0((sz / 2) + 1);
 
        dbg("Convert String to Binary!!");
 
        for (i = 0; i < sz; i += 2) {
                ret[i / 2] = (char) ((util_hexCharToInt(s[i]) << 4) | util_hexCharToInt(s[i + 1]));
-               dbg("[%02x]", ret[i / 2]);
+               msg("           [%02x]", ret[i / 2]);
        }
 
        return ret;
@@ -185,9 +185,10 @@ char* util_removeQuotes(void *data)
        if (data_len <= 0) {
                return NULL;
        }
-       tmp = calloc(1, data_len - 1);
+
+       tmp = g_try_malloc0(data_len - 1);
        memcpy(tmp, data + 1, data_len - 2);
-       dbg("tmp: %s", tmp);
+       dbg("tmp: [%s]", tmp);
 
        return tmp;
 }