Bug 279278 Fix Potential memory leak in nsImapServerResponseParser. Patch by Hans-Andreas Engel <Hans-A.Engel@unibas.ch>, r/sr=bienvenu

This commit is contained in:
bugzilla%standard8.demon.co.uk 2005-09-24 16:49:24 +00:00
Родитель ac96070edd
Коммит 6394335d7b
1 изменённых файлов: 14 добавлений и 8 удалений

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

@ -208,7 +208,12 @@ void nsImapServerResponseParser::ParseIMAPServerResponse(const char *currentComm
int numberOfTaggedResponsesReceived = 0;
char *copyCurrentCommand = PL_strdup(currentCommand);
if (copyCurrentCommand && !fServerConnection.DeathSignalReceived())
if (!copyCurrentCommand)
{
HandleMemoryFailure();
return;
}
if (!fServerConnection.DeathSignalReceived())
{
char *placeInTokenString = nsnull;
char *tagToken = nsnull;
@ -300,10 +305,7 @@ void nsImapServerResponseParser::ParseIMAPServerResponse(const char *currentComm
}
}
}
else if (!fServerConnection.DeathSignalReceived())
HandleMemoryFailure();
PR_Free(copyCurrentCommand);
PL_strfree(copyCurrentCommand);
}
void nsImapServerResponseParser::HandleMemoryFailure()
@ -367,9 +369,13 @@ void nsImapServerResponseParser::PreProcessCommandToken(const char *commandToken
}
else if (!PL_strcasecmp(commandToken, "UID"))
{
char *copyCurrentCommand = PL_strdup(currentCommand);
if (copyCurrentCommand && !fServerConnection.DeathSignalReceived())
if (!copyCurrentCommand)
{
HandleMemoryFailure();
return;
}
if (!fServerConnection.DeathSignalReceived())
{
char *placeInTokenString = nsnull;
char *tagToken = nsCRT::strtok(copyCurrentCommand, WHITESPACE,&placeInTokenString);
@ -386,8 +392,8 @@ void nsImapServerResponseParser::PreProcessCommandToken(const char *commandToken
fUidOfSingleMessageFetch = atoi(uidStringToken);
}
}
PR_Free(copyCurrentCommand);
}
PL_strfree(copyCurrentCommand);
}
}