vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi tech@, In usr.bin/pmdb/core.c, read_core() opens a core file, maps the file in memory but does not save nor close the file descriptor, also free_core() does not release the mapping. This diff closes the core file descriptor after its been mapped in memory (there seems to be no reason to save it) and munmap's the mapping. Index: core.c ================================================== ================= RCS file: /cvs/src/usr.bin/pmdb/core.c,v retrieving revision 1.6 diff -u -p -r1.6 core.c --- core.c 2003/08/17 23:43:45 1.6 +++ core.c 2007/07/30 18:48:18 @@ -67,6 +67,8 @@ read_core(const char *path, struct pstat if (core_map == MAP_FAILED) err(1, "mmap() failed on core"); + close(cfd); + cf->chdr = (struct core *)core_map; c_off = cf->chdr->c_hdrsize; if (CORE_GETMAGIC(*(cf->chdr)) != COREMAGIC) @@ -127,6 +129,12 @@ free_core(struct pstate *ps) free(cf->segs); cf->segs = NULL; } + + if (cf->chdr != NULL) { + munmap(cf->chdr, cf->cfstat.st_size); + cf->chdr = NULL; + } + } void -- sysadmin & coder @ http://www.evilkittens.org/ coder @ http://www.exalead.com/ [demime 1.01d removed an attachment of type application/pgp-signature] |