diff options
| author | Alexander Gavrilov | 2012-09-14 12:35:55 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-09-14 12:35:55 +0400 |
| commit | d22591e24050b8200899a0de8854c39efff9effd (patch) | |
| tree | cf87a87b713ca0e6341211dad5c2947780d52a85 /library | |
| parent | aaf5d181bd2a54e378c91b7a02a558126c4d5105 (diff) | |
| download | dfhack-d22591e24050b8200899a0de8854c39efff9effd.tar.gz dfhack-d22591e24050b8200899a0de8854c39efff9effd.tar.bz2 dfhack-d22591e24050b8200899a0de8854c39efff9effd.tar.xz | |
Fix a file descriptor leak and a crash in linux getMemRanges.
Diffstat (limited to 'library')
| -rw-r--r-- | library/Process-linux.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/library/Process-linux.cpp b/library/Process-linux.cpp index 4a66470f..1fecbab7 100644 --- a/library/Process-linux.cpp +++ b/library/Process-linux.cpp @@ -127,6 +127,9 @@ void Process::getMemRanges( vector<t_memrange> & ranges ) char permissions[5]; // r/-, w/-, x/-, p/s, 0 FILE *mapFile = ::fopen("/proc/self/maps", "r"); + if (!mapFile) + return; + size_t start, end, offset, device1, device2, node; while (fgets(buffer, 1024, mapFile)) @@ -148,6 +151,8 @@ void Process::getMemRanges( vector<t_memrange> & ranges ) temp.valid = true; ranges.push_back(temp); } + + fclose(mapFile); } uint32_t Process::getBase() |
