Bug 694570 - (2/4) - Annotate deliberate leak in SaveToEnv. r=karlt
authorOliver Henshaw <oliver.henshaw@gmail.com>
Mon, 20 Jun 2016 08:11:00 +0200
changeset 327249 8996273af30f193014006211f2eeeb10efe2eed3
parent 327248 10617f9fdc57dcb7f4a45b3f7d3bb9f9581a1ad7
child 327250 c37c930d089f97e44a3ae9846ac0ffb23e23ac67
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs694570
milestone50.0a1
Bug 694570 - (2/4) - Annotate deliberate leak in SaveToEnv. r=karlt Required now because the setenv calls in nsNativeAppSupportUnix::Start somehow prevent the leak in putenv from occurring. These setenv calls will be removed in the next patch.
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -282,16 +282,17 @@ using mozilla::dom::ContentChild;
 // Save literal putenv string to environment variable.
 static void
 SaveToEnv(const char *putenv)
 {
   char *expr = strdup(putenv);
   if (expr)
     PR_SetEnv(expr);
   // We intentionally leak |expr| here since it is required by PR_SetEnv.
+  MOZ_LSAN_INTENTIONALLY_LEAK_OBJECT(expr);
 }
 
 // Tests that an environment variable exists and has a value
 static bool
 EnvHasValue(const char *name)
 {
   const char *val = PR_GetEnv(name);
   return (val && *val);