summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-07-04 05:10:28 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-07-06 12:37:05 -0700
commit7261ef381a2c3c7bf5ef0ecd2392f7cab9e60e37 (patch)
treed70ec2719c24b608b07c88852211d20d567f88e7 /libglusterfs
parentc3f24c43a4cfb576a23de689c6107c4479e51307 (diff)
mem-pool: Do not perform chunkhead2ptr on MALLOCed memory
Memory allocated from the heap instead of the mem-pool need not under go the chunkhead to ptr conversion when returning to a mem-pool user since this address can be use directly. This fixes a crash in io-threads. Ref: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=102 Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/mem-pool.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c
index 90df2f39e..3937fcc37 100644
--- a/libglusterfs/src/mem-pool.c
+++ b/libglusterfs/src/mem-pool.c
@@ -118,8 +118,12 @@ mem_get (struct mem_pool *mem_pool)
* allocator is coming RSN.
*/
ptr = MALLOC (mem_pool->real_sizeof_type);
- if (!ptr)
- goto unlocked_out;
+
+ /* Memory coming from the heap need not be transformed from a
+ * chunkhead to a usable pointer since it is not coming from
+ * the pool.
+ */
+ goto unlocked_out;
}
fwd_addr_out:
ptr = mem_pool_chunkhead2ptr (ptr);