Open
Bug 292023
Opened 20 years ago
Updated 10 months ago
nssArenaHashAllocOps claims using NSSArena but actually doesn't.
Categories
(NSS :: Libraries, defect, P5)
Tracking
(Not tracked)
NEW
People
(Reporter: wtc, Unassigned)
Details
In lib/base/hashops.c, we have (null 'arena'
checks omitted for brevity):
/*
* hashops.c
*
* This file includes a set of PLHashAllocOps that use NSSArenas.
*/
static void * PR_CALLBACK
nss_arena_hash_alloc_table
(
void *pool,
PRSize size
)
{
NSSArena *arena = (NSSArena *)NULL;
return nss_ZAlloc(arena, size);
}
static void PR_CALLBACK
nss_arena_hash_free_table
(
void *pool,
void *item
)
{
(void)nss_ZFreeIf(item);
}
static PLHashEntry * PR_CALLBACK
nss_arena_hash_alloc_entry
(
void *pool,
const void *key
)
{
NSSArena *arena = NULL;
return nss_ZNEW(arena, PLHashEntry);
}
static void PR_CALLBACK
nss_arena_hash_free_entry
(
void *pool,
PLHashEntry *he,
PRUintn flag
)
{
if( HT_FREE_ENTRY == flag ) {
(void)nss_ZFreeIf(he);
}
}
NSS_IMPLEMENT_DATA PLHashAllocOps
nssArenaHashAllocOps = {
nss_arena_hash_alloc_table,
nss_arena_hash_free_table,
nss_arena_hash_alloc_entry,
nss_arena_hash_free_entry
};
This is used like this:
rv->plHashTable = PL_NewHashTable(0, nss_ckfw_identity_hash,
PL_CompareValues, PL_CompareValues, &nssArenaHashAllocOps, arena);
So an arena is passed as the 'pool' argument to those four
PLHashAllocOps callback functions, but they all ignore their
'pool' argument!
The obvious fix is to replace the line
NSSArena *arena = (NSSArena *)NULL;
by
NSSArena *arena = (NSSArena *)pool;
But I am worried this will cause some latent bug
to surface.
Alternatively, we can change the comment and identifier
names to reflect the code.
Updated•20 years ago
|
QA Contact: bishakhabanerjee → jason.m.reid
Updated•19 years ago
|
QA Contact: jason.m.reid → libraries
Updated•2 years ago
|
Severity: trivial → S4
Comment 1•2 years ago
|
||
The bug assignee is inactive on Bugzilla, so the assignee is being reset.
Assignee: wtc → nobody
Updated•10 months ago
|
Priority: -- → P5
You need to log in
before you can comment on or make changes to this bug.
Description
•