lkml.org 
[lkml]   [2002]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] request_region / release_resource mixup
Marcus Alanen wrote:
>
> Hi, looking at region and resource handling I see that request_region
> allocates the struct resource with kmalloc() while request_resource
> takes it as a parameter. This means that release_region uses kfree()
> and release_resource doesn't.
>
> There are some drivers which mix this up by doing a request_region /
> release_resource pair, instead of the proper request_region /
> release_region. This leads to a memory leak.
>
> I've tried to fix this below. Comments? Output is from bk diff -u,
> not sure what the best command would've been.

Good patch, but a comment. When you replace release_resource(res) with
release_region(), you should also look and see if you can eliminate the
temporary variable 'res' too.

--
Jeff Garzik | "I went through my candy like hot oatmeal
Building 1024 | through an internally-buttered weasel."
MandrakeSoft | - goats.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:24    [W:0.040 / U:5.488 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site