Use g_strdup() instead of strdup().
The strings are freed in dbus-glib with g_free(), hence we should use
g_strdup().
TEST=confirmed that update_engine worked as before
BUG=chromium-os:8197
Change-Id: Idf07d1ded34b7f55ac78d16b74fabb5701038068
Review URL: http://codereview.chromium.org/4097004
diff --git a/dbus_service.cc b/dbus_service.cc
index a27fd18..5a1a105 100644
--- a/dbus_service.cc
+++ b/dbus_service.cc
@@ -90,8 +90,8 @@
&new_version_str,
new_size));
- *current_operation = strdup(current_op.c_str());
- *new_version = strdup(new_version_str.c_str());
+ *current_operation = g_strdup(current_op.c_str());
+ *new_version = g_strdup(new_version_str.c_str());
if (!(*current_operation && *new_version)) {
*error = NULL;
return FALSE;
@@ -104,7 +104,7 @@
GError **error) {
string track_str =
chromeos_update_engine::OmahaRequestDeviceParams::GetDeviceTrack();
- *track = strdup(track_str.c_str());
+ *track = g_strdup(track_str.c_str());
return TRUE;
}