Closed Bug 866363 Opened 7 years ago Closed 7 years ago

SECITEM_FreeArray needs to free array->items

Categories

(NSS :: Libraries, defect, P1, major)

3.15

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wtc, Assigned: wtc)

References

Details

(Keywords: memory-leak)

Attachments

(1 file)

SECITEM_FreeArray needs to free array->items.

I suggest the following fix in secitem_FreeArray:

    for (i=0; i<array->len; ++i) {
        SECItem *item = &array->items[i];
        ...
    }
+
+   PORT_Free(array->items);
+   array->items = NULL;
+   array->len = 0;

    if (freeit)
        PORT_Free(array);
Attached patch PatchSplinter Review
Fix the memory leak of array->items in secitem_FreeArray.

Mark secitem_FreeArray as static. Don't need to include "base64.h".
Assignee: kaie → wtc
Attachment #743381 - Flags: superreview?(kaie)
Attachment #743381 - Flags: review?(ryan.sleevi)
Attachment #743381 - Flags: review?(ryan.sleevi) → review+
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Depends on: 360420
Resolution: --- → FIXED
Comment on attachment 743381 [details] [diff] [review]
Patch

Thank you!
Attachment #743381 - Flags: superreview?(kaie) → superreview+
You need to log in before you can comment on or make changes to this bug.