lkml.org 
[lkml]   [2011]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] fs, dlm: Don't leak, don't do pointless NULL checks and use kzalloc
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


\
 
 \ /
  Last update: 2011-06-30 00:19    [W:0.056 / U:0.864 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site