summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/system/statistics_provider.cc
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-14 21:35:10 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-14 21:35:10 +0000
commit93b9bdf3bfc791749189008b8067020198c114cc (patch)
treec7de6de69b9880d261678ca532d4fab47931361a /chrome/browser/chromeos/system/statistics_provider.cc
parentdbf3d40a6f20ffb94b1a0f095f1399441aad0cd2 (diff)
downloadchromium_src-93b9bdf3bfc791749189008b8067020198c114cc.zip
chromium_src-93b9bdf3bfc791749189008b8067020198c114cc.tar.gz
chromium_src-93b9bdf3bfc791749189008b8067020198c114cc.tar.bz2
Fix memory leaks from MessagePumpLibevent::Run() for Chrome OS.
valgrind detects leaks from MessagePumpLibevent::Run() when we fail to launch programs because of their non-existence (valgrind doesn't seem to handle cases like "fork -> exec failed -> _exit). For instance, tpcontrol and crossystem don't exist on Linux desktop. This patch to check existence of these tools before executing them. This is a good thing to do anyway, as emitting error like "LaunchApp: failed to execvp: /opt/google/touchpad/tpcontrol" on Linux desktop is noisy and confusing. BUG=46163 TEST=run AutomationProxyTest.GetBrowserWindowCount under valgrind locally and confirm that the leak is now gone. Review URL: http://codereview.chromium.org/7885017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101162 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/system/statistics_provider.cc')
-rw-r--r--chrome/browser/chromeos/system/statistics_provider.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/chrome/browser/chromeos/system/statistics_provider.cc b/chrome/browser/chromeos/system/statistics_provider.cc
index 4a85699..f863c1f 100644
--- a/chrome/browser/chromeos/system/statistics_provider.cc
+++ b/chrome/browser/chromeos/system/statistics_provider.cc
@@ -12,24 +12,27 @@ namespace chromeos {
namespace system {
namespace {
+// The tools used here should be specified as absolute paths. The
+// existence of the tools is checked in GetSingleValueFromTool().
+
// The system command that returns the hardware class.
const char kHardwareClassKey[] = "hardware_class";
-const char* kHardwareClassTool[] = { "crossystem", "hwid" };
+const char* kHardwareClassTool[] = { "/usr/bin/crossystem", "hwid" };
const char kUnknownHardwareClass[] = "unknown";
// Command to get machine hardware info and key/value delimiters.
// /tmp/machine-info is generated by platform/init/chromeos_startup.
-const char* kMachineHardwareInfoTool[] = { "cat", "/tmp/machine-info" };
+const char* kMachineHardwareInfoTool[] = { "/bin/cat", "/tmp/machine-info" };
const char kMachineHardwareInfoEq[] = "=";
const char kMachineHardwareInfoDelim[] = " \n";
// Command to get machine OS info and key/value delimiters.
-const char* kMachineOSInfoTool[] = { "cat", "/etc/lsb-release" };
+const char* kMachineOSInfoTool[] = { "/bin/cat", "/etc/lsb-release" };
const char kMachineOSInfoEq[] = "=";
const char kMachineOSInfoDelim[] = "\n";
// Command to get VPD info and key/value delimiters.
-const char* kVpdTool[] = { "cat", "/var/log/vpd_2.0.txt" };
+const char* kVpdTool[] = { "/bin/cat", "/var/log/vpd_2.0.txt" };
const char kVpdEq[] = "=";
const char kVpdDelim[] = "\n";