Messages in this thread | | | Date | Mon, 22 Sep 2008 16:42:32 -0600 | From | Matthew Wilcox <> | 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."
| |