From: Loic Dachary <loic@dachary.org>
To: Sage Weil <sage@inktank.com>, Xing Lin <xinglin@cs.utah.edu>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH] osd/erasurecode: Fix memory leak in jerasure_matrix_to_bitmatrix()
Date: Sat, 02 Nov 2013 10:16:33 +0100 [thread overview]
Message-ID: <5274C2F1.3000406@dachary.org> (raw)
In-Reply-To: <alpine.DEB.2.00.1311020002280.32481@cobra.newdream.net>
[-- Attachment #1: Type: text/plain, Size: 1702 bytes --]
On 02/11/2013 08:03, Sage Weil wrote:
> Hi!
>
> On Sat, 2 Nov 2013, Xing Lin wrote:
>> Free allocated memory before return because of NULL input
>>
>> Signed-off-by: Xing Lin <xinglin@cs.utah.edu>
>> ---
>> src/osd/ErasureCodePluginJerasure/jerasure.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/osd/ErasureCodePluginJerasure/jerasure.c b/src/osd/ErasureCodePluginJerasure/jerasure.c
>> index 9efae02..1bb4b1d 100755
>> --- a/src/osd/ErasureCodePluginJerasure/jerasure.c
>> +++ b/src/osd/ErasureCodePluginJerasure/jerasure.c
>> @@ -276,7 +276,10 @@ int *jerasure_matrix_to_bitmatrix(int k, int m, int w, int *matrix)
>> int rowelts, rowindex, colindex, elt, i, j, l, x;
>>
>> bitmatrix = talloc(int, k*m*w*w);
>> - if (matrix == NULL) { return NULL; }
>> + if (matrix == NULL) {
>> + free(bitmatrix);
>> + return NULL;
>> + }
>
> I have a feeling the author meant to say if (bitmatrix == NULL), since all
> the other talloc calls in this file tend to be followed by a NULL check?
Yes. Good catch Xing Lin :-)
Cheers
>
> sage
>
>
>>
>> rowelts = k * w;
>> rowindex = 0;
>> --
>> 1.8.3.4 (Apple Git-47)
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Loïc Dachary, Artisan Logiciel Libre
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
next prev parent reply other threads:[~2013-11-02 9:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-02 6:58 [PATCH] osd/erasurecode: Fix memory leak in jerasure_matrix_to_bitmatrix() Xing Lin
2013-11-02 7:03 ` Sage Weil
2013-11-02 9:16 ` Loic Dachary [this message]
2013-11-04 10:44 ` philippe.raipin
2013-11-04 14:29 ` Loic Dachary
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5274C2F1.3000406@dachary.org \
--to=loic@dachary.org \
--cc=ceph-devel@vger.kernel.org \
--cc=sage@inktank.com \
--cc=xinglin@cs.utah.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.