diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2012-12-19 15:29:15 +0100 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-12-20 15:06:59 +0200 |
commit | 13d88ea3301c9d333159d9eef486509b6a0836f3 (patch) | |
tree | d0af6ce31b62ba9622d7e245d22aea1da2999c5c | |
parent | a691bf284be676807545d2d4e9c000a0fcf35cce (diff) | |
download | connman-13d88ea3301c9d333159d9eef486509b6a0836f3.tar.gz connman-13d88ea3301c9d333159d9eef486509b6a0836f3.tar.bz2 connman-13d88ea3301c9d333159d9eef486509b6a0836f3.zip |
core: Use glib memory functions
Use for all memory allocation/dealocation operation the glib
functions. This allows us to use g_mem_profile().
-rw-r--r-- | src/device.c | 6 | ||||
-rw-r--r-- | src/inet.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/device.c b/src/device.c index 072646c7..d0c2e7e6 100644 --- a/src/device.c +++ b/src/device.c @@ -1167,7 +1167,7 @@ static char *index2ident(int index, const char *prefix) len = prefix ? strlen(prefix) + 18 : 18; - str = malloc(len); + str = g_malloc(len); if (!str) return NULL; @@ -1211,7 +1211,7 @@ static char *index2addr(int index) if (err < 0) return NULL; - str = malloc(18); + str = g_malloc(18); if (!str) return NULL; @@ -1265,7 +1265,7 @@ struct connman_device *connman_device_create_from_index(int index) case CONNMAN_DEVICE_TYPE_CELLULAR: case CONNMAN_DEVICE_TYPE_GPS: case CONNMAN_DEVICE_TYPE_VENDOR: - name = strdup(devname); + name = g_strdup(devname); break; } @@ -234,7 +234,7 @@ char *connman_inet_ifname(int index) if (err < 0) return NULL; - return strdup(ifr.ifr_name); + return g_strdup(ifr.ifr_name); } short int connman_inet_ifflags(int index) @@ -2280,7 +2280,7 @@ char **__connman_inet_get_running_interfaces(void) result[count++] = g_strdup(r->ifr_name); } - free(ifr); + g_free(ifr); if (count < numif) result = g_try_realloc(result, (count + 1) * sizeof(char *)); @@ -2289,7 +2289,7 @@ char **__connman_inet_get_running_interfaces(void) error: close(sk); - free(ifr); + g_free(ifr); return NULL; } |