diff --git a/xpinstall/src/nsSoftwareUpdate.cpp b/xpinstall/src/nsSoftwareUpdate.cpp index b7931ed468b..ca7853b5798 100644 --- a/xpinstall/src/nsSoftwareUpdate.cpp +++ b/xpinstall/src/nsSoftwareUpdate.cpp @@ -543,10 +543,6 @@ nsSoftwareUpdate::StubInitialize(nsIFile *aDir, const char* logName) else if ( !aDir ) return NS_ERROR_NULL_POINTER; - if (logName) - mLogName = PL_strdup(logName); - if (!mLogName) - return NS_ERROR_OUT_OF_MEMORY; // only allow once, it could be a mess if we've already started installing mStubLockout = PR_TRUE; @@ -560,6 +556,14 @@ nsSoftwareUpdate::StubInitialize(nsIFile *aDir, const char* logName) if (NS_SUCCEEDED(rv)) VR_SetRegDirectory( tempPath ); + // Optionally set logfile leafname + if (logName) + { + mLogName = PL_strdup(logName); + if (!mLogName) + return NS_ERROR_OUT_OF_MEMORY; + } + // Create the logfile observer nsLoggingProgressListener *logger = new nsLoggingProgressListener(); RegisterListener(logger); diff --git a/xpinstall/stub/xpistub.cpp b/xpinstall/stub/xpistub.cpp index c1dc181c93c..45f00e8621a 100644 --- a/xpinstall/stub/xpistub.cpp +++ b/xpinstall/stub/xpistub.cpp @@ -200,7 +200,10 @@ PR_PUBLIC_API(nsresult) XPI_Init( #endif if (hook && iDirSpec) - hook->StubInitialize( iDirSpec, aLogName ); + { + rv = hook->StubInitialize( iDirSpec, aLogName ); + if (NS_FAILED(rv)) return rv; + } else return NS_ERROR_NULL_POINTER;