Repository: trafficserver
Updated Branches:
  refs/heads/master 4f2dc70f0 -> 32f71df3a


TS-2735: Align all memory during freelist allocations


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

Branch: refs/heads/master
Commit: 32f71df3a021dbeaac3aff7bf0b23c9ec5fd64f4
Parents: 4f2dc70
Author: Phil Sorber <[email protected]>
Authored: Mon Apr 21 13:57:22 2014 -0600
Committer: Phil Sorber <[email protected]>
Committed: Mon Apr 21 13:57:22 2014 -0600

----------------------------------------------------------------------
 CHANGES             | 2 ++
 lib/ts/ink_queue.cc | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/32f71df3/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index d8ef4a0..c5e21f9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
+  *) [TS-2735] Align all memory during freelist allocations.
+
   *) [TS-2120] remove stale_while_revalidate plugin.
 
   *) [TS-2732] Add url_sign (Signed URL's) plugin.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/32f71df3/lib/ts/ink_queue.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_queue.cc b/lib/ts/ink_queue.cc
index c94e32d..7f5c172 100644
--- a/lib/ts/ink_queue.cc
+++ b/lib/ts/ink_queue.cc
@@ -103,7 +103,8 @@ ink_freelist_init(InkFreeList **fl, const char *name, 
uint32_t type_size,
   ink_assert(!(alignment & (alignment - 1)));
   f->alignment = alignment;
   f->chunk_size = chunk_size;
-  f->type_size = type_size;
+  // Make sure we align *all* the objects in the allocation, not just the 
first one
+  f->type_size = (type_size + (alignment - 1)) & ~(alignment - 1);
   SET_FREELIST_POINTER_VERSION(f->head, FROM_PTR(0), 0);
 
   f->used = 0;

Reply via email to