rv = (*function)(&xpcomFunctions, libPath); PR_Free(libPath);
char *libPath = PR_GetLibraryFilePathname(XPCOM_DLL, (PRFuncPtr) function); if (!libPath) rv = NS_ERROR_FAILURE; else { rv = (*function)(&xpcomFunctions, libPath); PR_Free(libPath); }
nsresult XPCOMGlueStartup(const char* xpcomFile){#ifdef XPCOM_GLUE_NO_DYNAMIC_LOADING    return NS_OK;#else    nsresult rv;    GetFrozenFunctionsFunc function;    xpcomFunctions.version = XPCOM_GLUE_VERSION;    xpcomFunctions.size    = sizeof(XPCOMFunctions);    //    // if xpcomFile == ".", then we assume xpcom is already loaded, and we'll    // use NSPR to find NS_GetFrozenFunctions from the list of already loaded    // libraries.    //    // otherwise, we try to load xpcom and then look for NS_GetFrozenFunctions.    // if xpcomFile == NULL, then we try to load xpcom by name w/o a fully    // qualified path.    //    if (xpcomFile && (xpcomFile[0] == '.' && xpcomFile[1] == '\0')) {        function = (GetFrozenFunctionsFunc)PR_FindSymbolAndLibrary("NS_GetFrozenFunctions", &xpcomLib);        if (!function)            return NS_ERROR_FAILURE;        char *libPath = PR_GetLibraryFilePathname(XPCOM_DLL, (PRFuncPtr) function);        if (!libPath)            rv = NS_ERROR_FAILURE;        else {            rv = (*function)(&xpcomFunctions, libPath);            PR_Free(libPath);        }    }    else {        PRLibSpec libSpec;        libSpec.type = PR_LibSpec_Pathname;        if (!xpcomFile)            libSpec.value.pathname = XPCOM_DLL;        else            libSpec.value.pathname = xpcomFile;        xpcomLib = PR_LoadLibraryWithFlags(libSpec, PR_LD_LAZY|PR_LD_GLOBAL);        if (!xpcomLib)            return NS_ERROR_FAILURE;        function = (GetFrozenFunctionsFunc) PR_FindSymbol(xpcomLib, "NS_GetFrozenFunctions");        if (!function)            rv = NS_ERROR_FAILURE;        else            rv = (*function)(&xpcomFunctions, libSpec.value.pathname);    }    if (NS_FAILED(rv))        goto bail;    rv = GlueStartupDebug();    if (NS_FAILED(rv))        goto bail;    // startup the nsMemory    rv = GlueStartupMemory();    if (NS_FAILED(rv)) {        GlueShutdownDebug();        goto bail;    }    GRE_AddGREToEnvironment();    return NS_OK;bail:    PR_UnloadLibrary(xpcomLib);    xpcomLib = nsnull;    memset(&xpcomFunctions, 0, sizeof(xpcomFunctions));    return NS_ERROR_FAILURE;#endif}