Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: patches/nss-secitem-array-leak.patch

Issue 14704003: Fix a memory leak in SECITEM_FreeArray. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « nss/lib/util/secitem.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 diff --git a/lib/util/secitem.c b/lib/util/secitem.c
2 --- a/lib/util/secitem.c
3 +++ b/lib/util/secitem.c
4 @@ -353,17 +352,18 @@ loser:
5 /*
6 * If array is not NULL, the above has set array->data and
7 * array->len to 0.
8 */
9 }
10 return(NULL);
11 }
12
13 -void secitem_FreeArray(SECItemArray *array, PRBool zero_items, PRBool freeit)
14 +static void
15 +secitem_FreeArray(SECItemArray *array, PRBool zero_items, PRBool freeit)
16 {
17 unsigned int i;
18
19 if (!array || !array->len || !array->items)
20 return;
21
22 for (i=0; i<array->len; ++i) {
23 SECItem *item = &array->items[i];
24 @@ -371,16 +371,19 @@ void secitem_FreeArray(SECItemArray *arr
25 if (item->data) {
26 if (zero_items) {
27 SECITEM_ZfreeItem(item, PR_FALSE);
28 } else {
29 SECITEM_FreeItem(item, PR_FALSE);
30 }
31 }
32 }
33 + PORT_Free(array->items);
34 + array->items = NULL;
35 + array->len = 0;
36
37 if (freeit)
38 PORT_Free(array);
39 }
40
41 void SECITEM_FreeArray(SECItemArray *array, PRBool freeit)
42 {
43 secitem_FreeArray(array, PR_FALSE, freeit);
OLDNEW
« no previous file with comments | « nss/lib/util/secitem.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698