trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sor...@apache.org
Subject [1/2] trafficserver git commit: TS-3962: Fix Coverity CID #1325824
Date Sun, 11 Oct 2015 22:02:12 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 7a4c85c0d -> f12a2fa4e


TS-3962: Fix Coverity CID #1325824


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/f9d63a4b
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/f9d63a4b
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/f9d63a4b

Branch: refs/heads/master
Commit: f9d63a4bf73cc1b84934d2db9010865a2d3fbf2a
Parents: 7a4c85c
Author: Phil Sorber <sorber@apache.org>
Authored: Sun Oct 11 16:01:39 2015 -0600
Committer: Phil Sorber <sorber@apache.org>
Committed: Sun Oct 11 16:01:39 2015 -0600

----------------------------------------------------------------------
 lib/ts/ink_queue.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f9d63a4b/lib/ts/ink_queue.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_queue.cc b/lib/ts/ink_queue.cc
index af66a0c..bba2d53 100644
--- a/lib/ts/ink_queue.cc
+++ b/lib/ts/ink_queue.cc
@@ -381,16 +381,19 @@ static void
 malloc_bulkfree(InkFreeList *f, void *head, void *tail, size_t num_item)
 {
   void *item = head;
+  void *next;
 
   // Avoid compiler warnings
   (void)tail;
 
   if (f->alignment) {
-    for (size_t i = 0; i < num_item && item; ++i, item = *(void **)item) {
+    for (size_t i = 0; i < num_item && item; ++i, item = next) {
+      next = *(void **)item; // find next item before freeing current item
       ats_memalign_free(item);
     }
   } else {
-    for (size_t i = 0; i < num_item && item; ++i, item = *(void **)item) {
+    for (size_t i = 0; i < num_item && item; ++i, item = next) {
+      next = *(void **)item; // find next item before freeing current item
       ats_free(item);
     }
   }


Mime
View raw message