diff options
author | Julia Lawall <julia@diku.dk> | 2011-07-09 12:04:39 -0400 |
---|---|---|
committer | Joel Becker <jlbec@evilplan.org> | 2011-11-17 04:46:46 -0500 |
commit | fc9f899483435935c1cd7005df29681929d1c99b (patch) | |
tree | c7ad164cfcfc16e5fb155e0ea3d3039eb47f0def /fs/ocfs2/dlm/dlmlock.c | |
parent | 99b1bb61b225c3eb4d3b196d4f1d041695b19a7e (diff) |
fs/ocfs2/dlm/dlmlock.c: free kmem_cache_zalloc'd data using kmem_cache_free
Memory allocated using kmem_cache_zalloc should be freed using
kmem_cache_free, not kfree.
The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression x,e,e1,e2;
@@
x = kmem_cache_zalloc(e1,e2)
... when != x = e
?-kfree(x)
+kmem_cache_free(e1,x)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Joel Becker <jlbec@evilplan.org>
Diffstat (limited to 'fs/ocfs2/dlm/dlmlock.c')
-rw-r--r-- | fs/ocfs2/dlm/dlmlock.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ocfs2/dlm/dlmlock.c b/fs/ocfs2/dlm/dlmlock.c index f32fcba04923..975810b98492 100644 --- a/fs/ocfs2/dlm/dlmlock.c +++ b/fs/ocfs2/dlm/dlmlock.c | |||
@@ -438,7 +438,7 @@ struct dlm_lock * dlm_new_lock(int type, u8 node, u64 cookie, | |||
438 | /* zero memory only if kernel-allocated */ | 438 | /* zero memory only if kernel-allocated */ |
439 | lksb = kzalloc(sizeof(*lksb), GFP_NOFS); | 439 | lksb = kzalloc(sizeof(*lksb), GFP_NOFS); |
440 | if (!lksb) { | 440 | if (!lksb) { |
441 | kfree(lock); | 441 | kmem_cache_free(dlm_lock_cache, lock); |
442 | return NULL; | 442 | return NULL; |
443 | } | 443 | } |
444 | kernel_allocated = 1; | 444 | kernel_allocated = 1; |