Fixing memory leak. bug# 9005 Thanks to <david.gardiner@unisa.edu.au>

This commit is contained in:
dp%netscape.com 1999-07-09 03:43:29 +00:00
Родитель c9261cc1b2
Коммит 081122d07d
1 изменённых файлов: 13 добавлений и 17 удалений

Просмотреть файл

@ -218,30 +218,26 @@ PRBool nsDll::Load(void)
#ifdef XP_MAC
// NSPR path is / separated. This works for all NSPR functions
// except Load Library. Translate to something NSPR can accepts.
char *macFileName = PL_strdup(nsprPath);
if (macFileName != NULL)
if (nsprPath[0] == '/')
{
if (macFileName[0] == '/')
// convert '/' to ':'
int c;
char* str = nsprPath;
while ((c = *str++) != 0)
{
// convert '/' to ':'
int c;
char* str = macFileName;
while ((c = *str++) != 0)
{
if (c == '/')
str[-1] = ':';
}
m_instance = PR_LoadLibrary(&macFileName[1]); // skip over initial slash
if (c == '/')
str[-1] = ':';
}
else
{
m_instance = PR_LoadLibrary(macFileName);
}
PL_strfree(macFileName);
m_instance = PR_LoadLibrary(&nsprPath[1]); // skip over initial slash
}
else
{
m_instance = PR_LoadLibrary(nsprPath);
}
#else
m_instance = PR_LoadLibrary(nsprPath);
#endif /* XP_MAC */
nsCRT::free(nsprPath);
}
return ((m_instance == NULL) ? PR_FALSE : PR_TRUE);
}