Closed Bug 587388 Opened 14 years ago Closed 2 years ago

nssCKFWObject_Create leaks fwObject when nssCKFWInstance_CreateMutex fails

Categories

(NSS :: Libraries, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

Details

(Keywords: coverity, memory-leak)

Attachments

(1 file)

fwObject = nss_ZNEW(arena, NSSCKFWObject);
...
   fwObject->mutex = nssCKFWInstance_CreateMutex(fwInstance, arena, pError);
   if (!fwObject->mutex) {
...
     return (NSSCKFWObject *)NULL;
Attached patch patchSplinter Review
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #466072 - Flags: review?(nelson)
Comment on attachment 466072 [details] [diff] [review]
patch

Except for patches to files under /security/nss/lib/ckfw/builtins, 
patches to files under /security/nss/lib/ckfw should be reviewed by rrelyea.
Attachment #466072 - Flags: review?(nelson) → review?(rrelyea)
Comment on attachment 466072 [details] [diff] [review]
patch

r- It really doesn't work to move allocations forward. In this case we will leak the mutex if we fail to allocate fwobject. Better just to free(fwObject) in the failure case for mutex.
Attachment #466072 - Flags: review?(rrelyea) → review-
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: