зеркало из https://github.com/mozilla/pjs.git
Bug 213692 libpref has some mismatched allocators r=timeless sr=bsmedberg
This commit is contained in:
Родитель
30bbc28ffb
Коммит
011de48a6f
|
@ -427,7 +427,7 @@ nsresult nsPrefService::WritePrefFile(nsIFile* aFile)
|
|||
if (*walker) {
|
||||
outStream->Write(*walker, strlen(*walker), &writeAmount);
|
||||
outStream->Write(NS_LINEBREAK, NS_LINEBREAK_LEN, &writeAmount);
|
||||
PR_Free(*walker);
|
||||
NS_Free(*walker);
|
||||
}
|
||||
}
|
||||
PR_Free(valueArray);
|
||||
|
|
|
@ -84,8 +84,10 @@ clearPrefEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
|
|||
PrefHashEntry *pref = static_cast<PrefHashEntry *>(entry);
|
||||
if (pref->flags & PREF_STRING)
|
||||
{
|
||||
PR_FREEIF(pref->defaultPref.stringVal);
|
||||
PR_FREEIF(pref->userPref.stringVal);
|
||||
if (pref->defaultPref.stringVal)
|
||||
PL_strfree(pref->defaultPref.stringVal);
|
||||
if (pref->userPref.stringVal)
|
||||
PL_strfree(pref->userPref.stringVal);
|
||||
}
|
||||
// don't need to free this as it's allocated in memory owned by
|
||||
// gPrefNameArena
|
||||
|
@ -213,8 +215,8 @@ void PREF_Cleanup()
|
|||
while (node)
|
||||
{
|
||||
next_node = node->next;
|
||||
PR_Free(node->domain);
|
||||
PR_Free(node);
|
||||
PL_strfree(node->domain);
|
||||
free(node);
|
||||
node = next_node;
|
||||
}
|
||||
gCallbacks = NULL;
|
||||
|
@ -443,7 +445,7 @@ PREF_CopyCharPref(const char *pref_name, char ** return_buffer, PRBool get_defau
|
|||
stringVal = pref->userPref.stringVal;
|
||||
|
||||
if (stringVal) {
|
||||
*return_buffer = PL_strdup(stringVal);
|
||||
*return_buffer = NS_strdup(stringVal);
|
||||
rv = NS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -659,7 +661,8 @@ static void pref_SetValue(PrefValue* oldValue, PrefValue newValue, PrefType type
|
|||
{
|
||||
case PREF_STRING:
|
||||
PR_ASSERT(newValue.stringVal);
|
||||
PR_FREEIF(oldValue->stringVal);
|
||||
if (oldValue->stringVal)
|
||||
PL_strfree(oldValue->stringVal);
|
||||
oldValue->stringVal = newValue.stringVal ? PL_strdup(newValue.stringVal) : NULL;
|
||||
break;
|
||||
|
||||
|
@ -834,8 +837,8 @@ pref_RemoveCallbackNode(struct CallbackNode* node,
|
|||
prev_node->next = next_node;
|
||||
else
|
||||
gCallbacks = next_node;
|
||||
PR_Free(node->domain);
|
||||
PR_Free(node);
|
||||
PL_strfree(node->domain);
|
||||
free(node);
|
||||
return next_node;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче