diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-10 15:17:24 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-10 15:17:24 -0700 |
commit | 7c283324da366a3e6ffaad4352a51a3c71fcae17 (patch) | |
tree | b4d02c340a17ac5134889c4eec7dcd06d407e3ca /mm/memcontrol.c | |
parent | 9e5869f8d70d94850cf86163c57ba8d4daa29924 (diff) | |
parent | 17ff3c1fa4c7bd0c38d751715033023ebf32fc96 (diff) |
Merge branch 'akpm' (Andrew's patch-bomb)
Merge misc fixes from Andrew Morton.
* emailed from Andrew Morton <akpm@linux-foundation.org>: (8 patches)
MAINTAINERS: add maintainer for LED subsystem
mm: nobootmem: fix sign extend problem in __free_pages_memory()
drivers/leds: correct __devexit annotations
memcg: free spare array to avoid memory leak
namespaces, pid_ns: fix leakage on fork() failure
hugetlb: prevent BUG_ON in hugetlb_fault() -> hugetlb_cow()
mm: fix division by 0 in percpu_pagelist_fraction()
proc/pid/pagemap: correctly report non-present ptes and holes between vmas
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 31ab9c3f017..b659260c56a 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4507,6 +4507,12 @@ static void mem_cgroup_usage_unregister_event(struct cgroup *cgrp, swap_buffers: /* Swap primary and spare array */ thresholds->spare = thresholds->primary; + /* If all events are unregistered, free the spare array */ + if (!new) { + kfree(thresholds->spare); + thresholds->spare = NULL; + } + rcu_assign_pointer(thresholds->primary, new); /* To be sure that nobody uses thresholds */ |