
On Thu, Feb 04, 2010 at 11:24:06AM +0100, Jim Meyering wrote:
Here's the patch: (note, no need to test for mapping == NULL in the no_memory block)
From 91dbe896fff64783df1c68769a57a267441143ae Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Thu, 4 Feb 2010 11:22:20 +0100 Subject: [PATCH] cgroup.c: don't leak mem+FD upon OOM
* src/util/cgroup.c (virCgroupDetectPlacement): Close the mapping FILE* also upon error. --- src/util/cgroup.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/util/cgroup.c b/src/util/cgroup.c index e6f0270..4446c7f 100644 --- a/src/util/cgroup.c +++ b/src/util/cgroup.c @@ -183,6 +183,7 @@ static int virCgroupDetectPlacement(virCgroupPtr group) return 0;
no_memory: + fclose(mapping); return -ENOMEM;
} -- 1.7.0.rc1.193.ge8618
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|