Changeset 660f70f4c4c169214da8ac670fbecfb37ce3d2d5
- Timestamp:
- 03/06/10 16:56:24
(5 months ago)
- Author:
- Joshua Brindle <method@manicmethod.com>
- Committer:
- Joshua Brindle <method@manicmethod.com> 1267916184 -0500
- Parent:
[c8d100bb03e0fe0501037b914fe3638afd593ee4]
- Message:
Author: Daniel J Walsh
Email: dwalsh@redhat.com
Subject: Fix memory leak on disabled selinux machines.
Date: Wed, 24 Feb 2010 14:15:31 -0500
I think this patch originally came from Eric Paris and was updated by
others but has not been adopted yet. Not sure why.
Always free buf on exit.
Signed-off-by: Joshua Brindle <method@manicmethod.com>
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r8c372f6 |
r660f70f |
|
| 24 | 24 | { |
|---|
| 25 | 25 | char *buf=NULL, *p; |
|---|
| 26 | | FILE *fp; |
|---|
| | 26 | FILE *fp=NULL; |
|---|
| 27 | 27 | struct statfs sfbuf; |
|---|
| 28 | 28 | int rc; |
|---|
| … | … | |
| 58 | 58 | } |
|---|
| 59 | 59 | } |
|---|
| | 60 | |
|---|
| | 61 | if (!exists) |
|---|
| | 62 | goto out; |
|---|
| | 63 | |
|---|
| 60 | 64 | fclose(fp); |
|---|
| 61 | | |
|---|
| 62 | | if (!exists) |
|---|
| 63 | | return; |
|---|
| 64 | 65 | |
|---|
| 65 | 66 | /* At this point, the usual spot doesn't have an selinuxfs so |
|---|
| … | … | |
| 67 | 68 | fp = fopen("/proc/mounts", "r"); |
|---|
| 68 | 69 | if (!fp) |
|---|
| 69 | | return; |
|---|
| | 70 | goto out; |
|---|
| 70 | 71 | |
|---|
| 71 | 72 | __fsetlocking(fp, FSETLOCKING_BYCALLER); |
|---|
| … | … | |
| 91 | 92 | out: |
|---|
| 92 | 93 | free(buf); |
|---|
| 93 | | fclose(fp); |
|---|
| | 94 | if (fp) |
|---|
| | 95 | fclose(fp); |
|---|
| 94 | 96 | return; |
|---|
| 95 | 97 | } |
|---|