[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080922224232.GB27204@parisc-linux.org>
Date: Mon, 22 Sep 2008 16:42:32 -0600
From: Matthew Wilcox <matthew@....cx>
To: Alex Chiang <achiang@...com>, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org, jbarnes@...tuousgeek.org,
kristen.c.accardi@...el.com, kaneshige.kenji@...fujitsu.com
Subject: Re: [PATCH v2 02/13] PCI: prevent duplicate slot names
On Mon, Sep 22, 2008 at 03:38:45PM -0600, Alex Chiang wrote:
> As Rolf Eike Beer pointed out, a failed krealloc() will leak the
> old version of new_name, so I did this instead:
>
> kfree(new_name);
> new_name = kmalloc(len, GFP_KERNEL);
>
> This is better than krealloc() in several ways:
>
> 1. we avoid the unneeded memcpy that krealloc() does for
> us. we don't need it because we're going to sprintf over
> it anyway.
>
> 2. the explicit kfree(new_name) means we won't leak
> anything.
Agreed.
--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists