зеркало из https://github.com/mozilla/pjs.git
Bug 243999 nsresult PrepareAcceptLanguages returns nsnull
patch by b.jacques@planet.nl r=biesi sr=darin a=bsmedberg
This commit is contained in:
Родитель
7ecfd9c993
Коммит
a91da2b11a
|
@ -1157,7 +1157,7 @@ PrepareAcceptLanguages(const char *i_AcceptLanguages, nsACString &o_AcceptLangua
|
|||
PRInt32 available;
|
||||
|
||||
o_Accept = nsCRT::strdup(i_AcceptLanguages);
|
||||
if (nsnull == o_Accept)
|
||||
if (!o_Accept)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
for (p = o_Accept, n = size = 0; '\0' != *p; p++) {
|
||||
if (*p == ',') n++;
|
||||
|
@ -1166,8 +1166,10 @@ PrepareAcceptLanguages(const char *i_AcceptLanguages, nsACString &o_AcceptLangua
|
|||
|
||||
available = size + ++n * 11 + 1;
|
||||
q_Accept = new char[available];
|
||||
if ((char *) 0 == q_Accept)
|
||||
return nsnull;
|
||||
if (!q_Accept) {
|
||||
nsCRT::free(o_Accept);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
*q_Accept = '\0';
|
||||
q = 1.0;
|
||||
dec = q / (double) n;
|
||||
|
|
Загрузка…
Ссылка в новой задаче