Bug 764249 (GLUSTER-2517) - the size of allocated memory may be wrong
Summary: the size of allocated memory may be wrong
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: GLUSTER-2517
Product: GlusterFS
Classification: Community
Component: replicate
Version: 3.1.2
Hardware: x86_64
OS: Linux
high
medium
Target Milestone: ---
Assignee: Pranith Kumar K
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-03-11 07:38 UTC by rick
Modified: 2011-05-03 11:43 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Regression: RTNR
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:


Attachments (Terms of Use)

Description rick 2011-03-11 07:38:55 UTC
hi,

in the call of afr_set_piggyback_dict()
arr = GF_CALLOC (3 * sizeof (int32_t), priv->child_count,gf_afr_mt_char);
should be
arr = GF_CALLOC (3 * sizeof (int32_t), 1,gf_afr_mt_char);
please check.

Comment 1 Vijay Bellur 2011-03-14 14:41:45 UTC
PATCH: http://patches.gluster.com/patch/6415 in master (cluster/afr: Fix wrong memory allocation)

Comment 2 Pranith Kumar K 2011-03-15 03:07:59 UTC
Thanks a lot for pointing it out Rick.

Comment 3 Raghavendra Bhat 2011-04-13 07:13:45 UTC
size_t pending_xattr_size = 3 * sizeof (int32_t);
        /* 3 = data+metadata+entry */

        index = afr_index_for_transaction_type (type);

        for (i = 0; i < priv->child_count; i++) {
                arr = GF_CALLOC (1, pending_xattr_size,
                                 gf_afr_mt_char);
		if (!arr) {
                        ret = -1;
                        goto out;
                }


This is fixed now as per the code.


Note You need to log in before you can comment on or make changes to this bug.