diff options
author | Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> | 2009-03-31 11:18:27 +0900 |
---|---|---|
committer | Dhaval Giani <dhaval@linux.vnet.ibm.com> | 2009-03-31 11:33:10 +0530 |
commit | dd1602c51180a63d2c75c049d7296c96cc1f51e9 (patch) | |
tree | 1d189813d12096145b0088a64384fd656b68cd1b /src/api.c | |
parent | 09f5406d4f4c48653d7b28fafd5dc776b0ba1284 (diff) | |
download | libcg-dd1602c51180a63d2c75c049d7296c96cc1f51e9.tar.gz libcg-dd1602c51180a63d2c75c049d7296c96cc1f51e9.tar.xz libcg-dd1602c51180a63d2c75c049d7296c96cc1f51e9.zip |
Add fclose() calls for error handling
I reviewed the libcgroup code in the viewpoint of memory-leak and
found some lacks of fclose(). This patch adds some fclose() calls
for error handling.
Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Diffstat (limited to 'src/api.c')
-rw-r--r-- | src/api.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -696,14 +696,17 @@ static int cg_test_mounted_fs() temp_ent = (struct mntent *) malloc(sizeof(struct mntent)); if (!temp_ent) { /* We just fail at the moment. */ + fclose(proc_mount); return 0; } ent = getmntent_r(proc_mount, temp_ent, mntent_buff, sizeof(mntent_buff)); - if (!ent) - return 0; + if (!ent) { + ret = 0; + goto done; + } while (strcmp(ent->mnt_type, "cgroup") !=0) { ent = getmntent_r(proc_mount, temp_ent, mntent_buff, |