diff --git a/xpcom/glue/standalone/nsGREDirServiceProvider.cpp b/xpcom/glue/standalone/nsGREDirServiceProvider.cpp index 6bf5aa96fa62..d765a8cc333a 100644 --- a/xpcom/glue/standalone/nsGREDirServiceProvider.cpp +++ b/xpcom/glue/standalone/nsGREDirServiceProvider.cpp @@ -271,10 +271,11 @@ nsGREDirServiceProvider::GetXPCOMPath() { char* grePath = GetGREDirectoryPath(); if (!grePath) { - grePath = PR_GetEnv("MOZILLA_FIVE_HOME"); - if (!grePath) { + char* greEnv = PR_GetEnv("MOZILLA_FIVE_HOME"); + if (!greEnv) { return nsnull; } + grePath = strdup(greEnv); } int len = strlen(grePath);