Bug 547673 - Fix reading freed memory in XSMP handling. r=bsmedberg
authorWolfgang Rosenauer <wr@rosenauer.org>
Fri, 05 Mar 2010 22:56:40 +0100
changeset 39012 6f141492d141f635a0ab4b1c0266b1b477676d17
parent 39011 26dc9dc42c2ed69145b9a6708128f3edd49dad41
child 39013 c05d0ac5630710bf4eb3e3bcae5a85f04f18c5c8
push idunknown
push userunknown
push dateunknown
reviewersbsmedberg
bugs547673
milestone1.9.3a3pre
Bug 547673 - Fix reading freed memory in XSMP handling. r=bsmedberg
toolkit/xre/nsNativeAppSupportUnix.cpp
--- a/toolkit/xre/nsNativeAppSupportUnix.cpp
+++ b/toolkit/xre/nsNativeAppSupportUnix.cpp
@@ -408,30 +408,29 @@ nsNativeAppSupportUnix::Start(PRBool *aR
 
   GnomeClient *client = gnome_master_client();
   g_signal_connect(client, "save-yourself", G_CALLBACK(save_yourself_cb), NULL);
   g_signal_connect(client, "die", G_CALLBACK(die_cb), NULL);
 
   // Set the correct/requested restart command in any case.
 
   // Is there a request to suppress default binary launcher?
+  nsCAutoString path;
   char* argv1 = getenv("MOZ_APP_LAUNCHER");
 
   if(!argv1) {
     // Tell the desktop the command for restarting us so that we can be part of XSMP session restore
     NS_ASSERTION(gDirServiceProvider, "gDirServiceProvider is NULL! This shouldn't happen!");
     nsCOMPtr<nsIFile> executablePath;
     nsresult rv;
 
     PRBool dummy;
     rv = gDirServiceProvider->GetFile(XRE_EXECUTABLE_FILE, &dummy, getter_AddRefs(executablePath));
 
     if (NS_SUCCEEDED(rv)) {
-      nsCAutoString path;
-
       // Strip off the -bin suffix to get the shell script we should run; this is what Breakpad does
       nsCAutoString leafName;
       rv = executablePath->GetNativeLeafName(leafName);
       if (NS_SUCCEEDED(rv) && StringEndsWith(leafName, NS_LITERAL_CSTRING("-bin"))) {
         leafName.SetLength(leafName.Length() - strlen("-bin"));
         executablePath->SetNativeLeafName(leafName);
       }