From: Marek Lindner <mareklindner@neomailbox.ch>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Sven Eckelmann <sven@narfation.org>
Subject: Re: [B.A.T.M.A.N.] [PATCHv2 3/3] batctl: Use memleak/error path free implementation of hash_resize
Date: Thu, 12 Jun 2014 17:30:51 +0800 [thread overview]
Message-ID: <350643063.kDBGdMaN5Y@diderot> (raw)
In-Reply-To: <1401200612-19725-1-git-send-email-sven@narfation.org>
[-- Attachment #1: Type: text/plain, Size: 860 bytes --]
On Tuesday 27 May 2014 16:23:32 Sven Eckelmann wrote:
> The current implementation of hash_resize uses hash_add directly to
> initialize a new hash table. But hash_add has two possible situations when
> it returns an error and hash_resize would leak the data:
>
> * data already exists
> * malloc fails
>
> The check for the duplicated data is not really harmful (beside increasing
> the time to re-add elements) but the malloc can potentially return an
> error. This malloc is unnecessary and just takes extra time. Instead the
> bucket from the old hash table can be re-used.
>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
> v2:
> * fixed commit message
>
> hash.c | 72
> ++++++++++++++++++++++++++++++++++++++++-------------------------- 1 file
> changed, 44 insertions(+), 28 deletions(-)
Applied in revision 6f03fcf.
Thanks,
Marek
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2014-06-12 9:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-24 13:56 [B.A.T.M.A.N.] [PATCH 1/3] batctl: Import hash table version from alfred Sven Eckelmann
2014-05-24 13:56 ` [B.A.T.M.A.N.] [PATCH 2/3] batctl: Free hash iterator when breaking out of loop Sven Eckelmann
2014-06-12 9:29 ` Marek Lindner
2014-05-24 13:56 ` [B.A.T.M.A.N.] [PATCH 3/3] batctl: Use memleak/error path free implementation of hash_resize Sven Eckelmann
2014-05-27 14:23 ` [B.A.T.M.A.N.] [PATCHv2 " Sven Eckelmann
2014-06-12 9:30 ` Marek Lindner [this message]
2014-06-12 9:28 ` [B.A.T.M.A.N.] [PATCH 1/3] batctl: Import hash table version from alfred Marek Lindner
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=350643063.kDBGdMaN5Y@diderot \
--to=mareklindner@neomailbox.ch \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=sven@narfation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox