author | Tim Huang <tihuang@mozilla.com> |
Fri, 21 Jul 2017 11:49:21 +0800 | |
changeset 370539 | 80b3b7fa1e23f3c504a9013a219218238a20ce63 |
parent 370538 | 7e21499a9eb443a7492c722930e7b0c21f8ce433 |
child 370563 | 17d7de773b6d3aecd88fdd7882b7d236b4f62e37 |
push id | 47067 |
push user | ryanvm@gmail.com |
push date | Mon, 24 Jul 2017 12:57:10 +0000 |
treeherder | autoland@80b3b7fa1e23 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | Ehsan |
bugs | 1382840 |
milestone | 56.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
toolkit/components/resistfingerprinting/nsRFPService.cpp | file | annotate | diff | comparison | revisions |
--- a/toolkit/components/resistfingerprinting/nsRFPService.cpp +++ b/toolkit/components/resistfingerprinting/nsRFPService.cpp @@ -143,17 +143,29 @@ nsRFPService::UpdatePref() PR_SetEnv("TZ=UTC"); JS::SetTimeResolutionUsec(kResolutionUSec); } else if (sInitialized) { JS::SetTimeResolutionUsec(0); // We will not touch the TZ value if 'privacy.resistFingerprinting' is false during // the time of initialization. if (!mInitialTZValue.IsEmpty()) { nsAutoCString tzValue = NS_LITERAL_CSTRING("TZ=") + mInitialTZValue; - PR_SetEnv(tzValue.get()); + static char* tz = nullptr; + + // If the tz has been set before, we free it first since it will be allocated + // a new value later. + if (tz) { + free(tz); + } + // PR_SetEnv() needs the input string been leaked intentionally, so + // we copy it here. + tz = ToNewCString(tzValue); + if (tz) { + PR_SetEnv(tz); + } } else { #if defined(XP_LINUX) || defined (XP_MACOSX) // For POSIX like system, we reset the TZ to the /etc/localtime, which is the // system timezone. PR_SetEnv("TZ=:/etc/localtime"); #else // For Windows, we reset the TZ to an empty string. This will make Windows to use // its system timezone.