Fix a getcwd(3) bug and make our tests run correctly under valgrind.

The getcwd(3) bug was found by valgrind.

Bug: 7291287
Change-Id: I59f3bff1c1392a408b905934eebcd5d894d37492
This commit is contained in:
Elliott Hughes
2012-10-09 17:14:56 -07:00
parent 9a7366e894
commit 156da96621
2 changed files with 6 additions and 5 deletions

View File

@@ -88,7 +88,7 @@ TEST(dlopen, dladdr) {
uintptr_t start = strtoul(line, 0, 16);
line[strlen(line) - 1] = '\0'; // Chomp the '\n'.
char* path = strchr(line, '/');
if (strcmp(executable_path, path) == 0) {
if (path != NULL && strcmp(executable_path, path) == 0) {
base_address = reinterpret_cast<void*>(start);
break;
}