cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: David Teigland <teigland@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] fs, dlm: Don't leak, don't do pointless NULL checks and use kzalloc
Date: Wed, 29 Jun 2011 18:17:31 -0400	[thread overview]
Message-ID: <20110629221731.GB11350@redhat.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1106292344110.3747@swampdragon.chaosbits.net>

On Wed, Jun 29, 2011 at 11:51:00PM +0200, Jesper Juhl wrote:
> > I don't think so; num_nodes won't be set to zero.
> 
> Hmm. How so?  Maybe I'm missing something obvious, but;
> num_nodes is initialized to zero at the beginning of the function, which 
> means that we'll definately do the first allocation in the loop.

Zero is meant to mean "first time through the loop".

> We then set num_nodes equal to ls->ls_num_nodes - what guarantees that 
> this will not be zero so we won't do a second allocation (and leak) the 
> second time through the loop?

That's just the nature of a lockspace, I guess -- it doesn't make sense or
exist without nodes in it.  I doubt any of the dlm code would work if that
weren't true.

Dave



      parent reply	other threads:[~2011-06-29 22:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <alpine.LNX.2.00.1106292304380.3747@swampdragon.chaosbits.net>
2011-06-29 21:40 ` [Cluster-devel] [PATCH] fs, dlm: Don't leak, don't do pointless NULL checks and use kzalloc David Teigland
     [not found]   ` <alpine.LNX.2.00.1106292344110.3747@swampdragon.chaosbits.net>
2011-06-29 22:17     ` David Teigland [this message]

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=20110629221731.GB11350@redhat.com \
    --to=teigland@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).