Closed Bug 440062 Opened 17 years ago Closed 17 years ago

incorrect list element count in PKIX_List_AppendItem function

Categories

(NSS :: Libraries, defect, P2)

3.12
defect

Tracking

(Not tracked)

RESOLVED FIXED
3.12.1

People

(Reporter: alvolkov.bgs, Assigned: alvolkov.bgs)

Details

(Whiteboard: PKIX)

Attachments

(1 file)

PKIX_List structure is the single linked list of PKIX_List object. The head structure keeps count of elements in the list. PKIX_List_AppendItem increments count at the end of function upon success. If PKIX_INCREF(item) returns error, new member(object of PKIX_List structure) will be added to the list, but the count will not be incremented and so the object will be leaked. Here is the code: lastElement = list; for (i = 0; i < length; i++){ lastElement = lastElement->next; } PKIX_CHECK(pkix_List_Create_Internal (PKIX_FALSE, &lastElement->next, plContext), PKIX_LISTCREATEINTERNALFAILED); PKIX_INCREF(item); newElement->item = item; PKIX_CHECK(PKIX_PL_Object_InvalidateCache ((PKIX_PL_Object *)list, plContext), PKIX_OBJECTINVALIDATECACHEFAILED); list->length = list->length + 1;
Attachment #325592 - Flags: review?(nelson)
Comment on attachment 325592 [details] [diff] [review] Add new member to the list only upon success. r=nelson
Attachment #325592 - Flags: review?(nelson) → review+
Patch integrated.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Priority: -- → P2
Whiteboard: PKIX
Target Milestone: --- → 3.12.1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: