components/openvswitch/patches/07-ovsthread_key_destruct-fix.patch
author Stacy Yeh <stacy.yeh@oracle.com>
Mon, 11 Jan 2016 09:27:45 -0800
changeset 5255 cea0e462549a
parent 5090 5f131162e136
child 5730 cca4aa297e68
permissions -rw-r--r--
22322082 Move Firefox/Thunderbird from Desktop consolidation to Userland

This patch fixes a bug in ovsthread_key_destruct__.

This patch has not been proposed upstream but will be proposed for 2.4.

diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c
index 529756f..11735f9 100644
--- a/lib/ovs-thread.c
+++ b/lib/ovs-thread.c
@@ -641,8 +641,10 @@ ovsthread_key_destruct__(void *slots_)
     n = n_keys;
     ovs_mutex_unlock(&key_mutex);
 
-    for (i = 0; i < n / L2_SIZE; i++) {
-        free(slots->p1[i]);
+    if (n > 0) {
+	    for (i = 0; i <= (n - 1) / L2_SIZE; i++) {
+                free(slots->p1[i]);
+        }
     }
     free(slots);
 }