aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/dbus/dbus_new_introspect.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-01-01 12:15:12 (GMT)
committerJouni Malinen <j@w1.fi>2010-01-01 12:15:12 (GMT)
commit4292b01322dab343cba47b4e005bc29501284cec (patch)
tree67726d3e9a70c0c24391a88f18324fe5f65838a2 /wpa_supplicant/dbus/dbus_new_introspect.c
parent04551ee6d67cf217ee81c1e8cb07a49a667239f4 (diff)
downloadhostap-4292b01322dab343cba47b4e005bc29501284cec.zip
hostap-4292b01322dab343cba47b4e005bc29501284cec.tar.gz
hostap-4292b01322dab343cba47b4e005bc29501284cec.tar.bz2
dbus: Use strdup instead of malloc+strncpy
Diffstat (limited to 'wpa_supplicant/dbus/dbus_new_introspect.c')
-rw-r--r--wpa_supplicant/dbus/dbus_new_introspect.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/wpa_supplicant/dbus/dbus_new_introspect.c b/wpa_supplicant/dbus/dbus_new_introspect.c
index 2cd7c88..bb084a4 100644
--- a/wpa_supplicant/dbus/dbus_new_introspect.c
+++ b/wpa_supplicant/dbus/dbus_new_introspect.c
@@ -46,7 +46,6 @@ static struct interfaces * extract_interfaces(
struct wpa_dbus_property_desc *property_dsc = obj_dsc->properties;
struct interfaces *head = NULL;
struct interfaces *iface, *last;
- int len;
/* extract interfaces from methods */
while (method_dsc) {
@@ -79,8 +78,7 @@ static struct interfaces * extract_interfaces(
else
head = iface;
- len = os_strlen(method_dsc->dbus_interface) + 1;
- iface->dbus_interface = os_malloc(len);
+ iface->dbus_interface = os_strdup(method_dsc->dbus_interface);
if (!iface->dbus_interface) {
wpa_printf(MSG_ERROR, "Not enough memory to create "
"interface introspection data (interface "
@@ -88,8 +86,6 @@ static struct interfaces * extract_interfaces(
method_dsc = method_dsc->next;
continue;
}
- os_strncpy(iface->dbus_interface, method_dsc->dbus_interface,
- len);
iface->interface_node = xmlNewChild(root_node, NULL,
BAD_CAST "interface",
@@ -131,8 +127,7 @@ static struct interfaces * extract_interfaces(
else
head = iface;
- len = os_strlen(signal_dsc->dbus_interface) + 1;
- iface->dbus_interface = os_malloc(len);
+ iface->dbus_interface = os_strdup(signal_dsc->dbus_interface);
if (!iface->dbus_interface) {
wpa_printf(MSG_ERROR, "Not enough memory to create "
"interface introspection data (interface "
@@ -140,8 +135,6 @@ static struct interfaces * extract_interfaces(
signal_dsc = signal_dsc->next;
continue;
}
- os_strncpy(iface->dbus_interface, signal_dsc->dbus_interface,
- len);
iface->interface_node = xmlNewChild(root_node, NULL,
BAD_CAST "interface",
@@ -183,8 +176,8 @@ static struct interfaces * extract_interfaces(
else
head = iface;
- len = os_strlen(property_dsc->dbus_interface) + 1;
- iface->dbus_interface = os_malloc(len);
+ iface->dbus_interface =
+ os_strdup(property_dsc->dbus_interface);
if (!iface->dbus_interface) {
wpa_printf(MSG_ERROR, "Not enough memory to create "
"interface introspection data (interface "
@@ -192,8 +185,6 @@ static struct interfaces * extract_interfaces(
property_dsc = property_dsc->next;
continue;
}
- os_strncpy(iface->dbus_interface, property_dsc->dbus_interface,
- len);
iface->interface_node = xmlNewChild(root_node, NULL,
BAD_CAST "interface",