Index: patches/nss-secitem-array-leak.patch |
=================================================================== |
--- patches/nss-secitem-array-leak.patch (revision 0) |
+++ patches/nss-secitem-array-leak.patch (revision 0) |
@@ -0,0 +1,43 @@ |
+diff --git a/lib/util/secitem.c b/lib/util/secitem.c |
+--- a/lib/util/secitem.c |
++++ b/lib/util/secitem.c |
+@@ -353,17 +352,18 @@ loser: |
+ /* |
+ * If array is not NULL, the above has set array->data and |
+ * array->len to 0. |
+ */ |
+ } |
+ return(NULL); |
+ } |
+ |
+-void secitem_FreeArray(SECItemArray *array, PRBool zero_items, PRBool freeit) |
++static void |
++secitem_FreeArray(SECItemArray *array, PRBool zero_items, PRBool freeit) |
+ { |
+ unsigned int i; |
+ |
+ if (!array || !array->len || !array->items) |
+ return; |
+ |
+ for (i=0; i<array->len; ++i) { |
+ SECItem *item = &array->items[i]; |
+@@ -371,16 +371,19 @@ void secitem_FreeArray(SECItemArray *arr |
+ if (item->data) { |
+ if (zero_items) { |
+ SECITEM_ZfreeItem(item, PR_FALSE); |
+ } else { |
+ SECITEM_FreeItem(item, PR_FALSE); |
+ } |
+ } |
+ } |
++ PORT_Free(array->items); |
++ array->items = NULL; |
++ array->len = 0; |
+ |
+ if (freeit) |
+ PORT_Free(array); |
+ } |
+ |
+ void SECITEM_FreeArray(SECItemArray *array, PRBool freeit) |
+ { |
+ secitem_FreeArray(array, PR_FALSE, freeit); |